We have an open project for HMM models, writen in C language, that was used in some researches related to speech recognition . You can take a look and also use it if want. The project is separated in training (https://github.com/edielsonpf/hmmtrain) and testing (https://github.com/edielsonpf/hmmreco).
The hmmer.org website provides user friendly tools to create hidden Markov models based on alignments. It seems the website has changed recently so I am not entirely familiar with the new format or your exact application If you are trying to find homologous sequences in unknown genomes, in principle you want to compile a comprehensive list of homologs across kingdoms or phylla.More sequences are better. Than create an alignment in clustal and export it in Stockholm format and upload to hmmer. It used to be that you could then view similar sequence hits across kingdoms and phylla using jackhammer. There may be a way to export the markov model. Hope this points you in the right direction.
Perhaps I've misread your question but it sounds to me like you're looking for an ab-initio gene finding program?
There are plenty of gene prediction/detection programs already available, so there's really no need to design your own algorithm unless you have a particular shortcoming that you want to address. Most gene prediction programs use HMMs or other methods to find a profile of gene structures (eg codon usage, common intron sequence biases intron boundary points etc). The gold standard now is to use RNASeq or proteomics guided gene prediction (especially if you are working with a non-model organism).
Augustus (see link 1) generally benchmarks fairly well and provides options for both ab-initio and RNASeq guided gene prediction.
Alternatively if you have a set of gene sequences and you want to see if they are present in your new genome you might try HMMER as suggested by Alexander above, or simply a BLAST based approach like genblast (see link 2) might suffice.
Just as a side note, I think that it's important to think of exactly what you want to achieve before deciding on a method. HMMs are great and commonly used in bioinformatics but they aren't a computational panacea.