On 1/5/2012 00:26, Riadh ZAATOUR wrote:
Hello everybody,
I am trying to make a Wrapper for the nlopt dll in managed Code to make
it callable from C# or other .Net languages.
When I include nlopt.hpp in my wrapper project, I have these strange
link errors, even if my project contains an empty class :
1>nloptWrapper.obj : error LNK2028: unresolved token (0A000177) "extern
"C" struct nlopt_opt_s * __stdcall nlopt_copy(struct nlopt_opt_s *
const)" (?nlopt_copy@@$$J14YGPAUnlopt_opt_s@@QAU1@@Z) referenced in
function "public: __thiscall nlopt::opt::opt(class nlopt::opt const &)"
(??0opt@nlopt@@$$FQAE@ABV01@@Z)
1>nloptWrapper.obj : error LNK2019: unresolved external symbol "extern
"C" struct nlopt_opt_s * __stdcall nlopt_copy(struct nlopt_opt_s *
const)" (?nlopt_copy@@$$J14YGPAUnlopt_opt_s@@QAU1@@Z) referenced in
function "public: __thiscall nlopt::opt::opt(class nlopt::opt const &)"
(??0opt@nlopt@@$$FQAE@ABV01@@Z)
1>C:\Users\riadh\Documents\My
Dropbox\HighFrequency\Code\Debug\nloptWrapper.dll : fatal error LNK1120:
2 unresolved externals
I have not any errors if I include nlopt.h instead.
Just use the C header nlopt.h, I don't expect you can be successful with
the C++ header nlopt.hpp due to name mangling (those "strange" names you
see in your link errors are the result thereof):
http://en.wikipedia.org/wiki/Name_mangling
A possible exception is if you can use CXXI --
http://tirania.org/blog/archive/2011/Dec-19.html -- haven't tested it
yet, personally.
Best,
Matt
_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss