Is there a way to make dll library compatible with STL contatiners when usin loadlibrary
Show older comments
Hi
I compiled a Dll project with vs2010 (VC10 compiler). Some function have STL containers (such as vectors,lists ...) in their interface. So far it seems to be impossible using these functions when loading the dll using 'loadlibrary'.
Is there an elegant was to use such functions ?
Answers (1)
Kaustubha Govind
on 16 Oct 2012
0 votes
As per the documentation for loadlibrary, you need to specify a C header file, so you cannot use C++ datatypes like STL containers in the function prototype. The best I can think of is to create wrapper functions that take C-style containers and convert them to the STL containers before calling into the DLL. You might need to create another DLL for the wrapper versions.
Alternatively, if you're comfortable with C/C++, perhaps you could use MEX-functions to interface with the library instead of LOADLIBRARY.
Categories
Find more on STL (STereoLithography) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!