Page 1 of 1

External Libraries

Posted: 31 May 2012, 09:36
by dmichler
Hello! I am having a bit of trouble using external libraries into BCI2000.

I am using VS2010 and can successfully compile (so the library is included and linked correctly) but I am getting a runtime crash when one of the functions is actually used. I assume this must be due to my misunderstanding something about CMAKE. Is there a tutorial around for including external libraries, even if it is just specific to CMAKE, or some hint you can give me?

Many thanks

Re: External Libraries

Posted: 04 Jun 2012, 11:57
by mellinger

when your code links successfully, I don't think there is anything wrong with your CMake setup. From what you write, it seems that you are linking against an import library (.lib file) coming with the library. Make sure that this .lib file matches the version of the actual library (.dll file), and that the header file coming with the library matches the version of both the dll and the lib file.

Problems may arise from inconsistent calling conventions (stdcall vs cdecl), but typically such inconsistencies lead to linker errors.

Also make sure that you read the documentation of the library. Often, it is required to call some initialization function from the library before calling any other function.