Menu

#414 Allow static builds of SphinxBase and PocketSphinx using MSVC

next release
closed
nobody
None
5
2016-01-22
2015-01-31
David Brown
No

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.

Discussion

  • Nickolay V. Shmyrev

    Sure, that would be great.

     
    • Nickolay V. Shmyrev

      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.

       
      • Nickolay V. Shmyrev

        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.

         
        • David Brown

          David Brown - 2015-01-31

          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
          • Nickolay V. Shmyrev

            That would require changes to the SphinxBase and PocketSphinx autotools scripts, right?

            No, you don't need to change anything in automake, all should go within ifdef _WIN32

             
            • David Brown

              David Brown - 2015-01-31

              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.

               
  • Montagu Adrien

    Montagu Adrien - 2015-08-19

    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 ?

     
  • Nickolay V. Shmyrev

    • status: open --> closed
     
  • Nickolay V. Shmyrev

    Yeah, its required. This issue fixed now, I reintroduced SPHINX_DLL macros to compile DLL, otherwise it will compile static code.

     

Log in to post a comment.

MongoDB Logo MongoDB