The current state of sphinxbase_export.h and pocketsphinx_export.h makes it impossible to build working static libraries when using MSVC. The Visual Studio projects already define a SPHINXDLL symbol, so the preprocessor logic in those two headers can be reduced to "#ifdef SPHINXDLL". The symbol would also have to be defined in the SphinxTrain projects.
I'm happy to submit a patch for this once I get an opportunity to grab a copy of the SphinxTrain code to test with.
Sure, that would be great.
But please also note that SPHINXDLL is not used (I've just removed it). The relevant macros are POCKETSPHINX_EXPORTS and SPHINXBASE_EXPORTS.
Please make sure you are looking on the latest code.
After some thinking I think it's better to introduce something like SPHINX_STATIC to disable dll instead so we don't have to modify other projects like sphinxtrain.
I believe that's how most projects do it. That would require changes to the SphinxBase and PocketSphinx autotools scripts, right? I'm only familiar with Visual Studio and CMake, unfortunately.
Last edit: David Brown 2015-01-31
No, you don't need to change anything in automake, all should go within ifdef _WIN32
MinGW and Cygwin builds might break without changes to the autotools scripts, because both environments will define _WIN32 and end up with __declspec-annotated symbols in static libraries. But again, I don't know enough about autotools to know for sure and I can't get MSYS working at the moment to test it. Sorry.
Hi !
Have you done somethings like this for build static library ? If not what I need to define instead of declspec(dllexport) for build static lib ?
Yeah, its required. This issue fixed now, I reintroduced SPHINX_DLL macros to compile DLL, otherwise it will compile static code.