Hi,
perhaps this could be interesting at some point: I've noticed that the
'dynr' package for R covers a bunch of Markov switching setups and says
about itself that "All estimation and computations are performed in C".
(
https://cran.r-project.org/web/packages/dynr/index.html)
Perhaps that C code base could be adopted at some point. I couldn't find
any license information in the files, but the package page above says
simply GPL-3.
Certainly not in the short term...
cheers
sven