[Mono-dev] mono_config_parse won't link, needs extern "C" declaration in header file
sebastian at palladiumconsulting.com
Tue Apr 1 16:51:52 EDT 2008
I am compiling an application against the Mono embedding API, version 1.2.6.
All is wonderful, except I cannot link successfully when I try to compile
against mono_config_parse(const char*). The mono.lib which was nicely
supplied to me on this mailing list some months ago claims that the function
is exported by mono.dll. Running dumpbin /exports mono.dll also shows
mono_config_parse as an entry point in the DLL, yet I get the following
error from MSVC
error LNK2019: unresolved external symbol "void __cdecl
mono_config_parse(char const *)" (?mono_config_parse@@YAXPBD at Z) referenced
in function "public: __thiscall MonoEmbed::MonoEmbed(class
std::allocator<char> >)" (??0MonoEmbed@@QAE at V?$basic_string@
DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@Z)
I believe this is because the relevant declarations are not marked extern
"C". Doing so (by adding G_BEGIN_DECLS and G_END_DECLS to
<mono/metadata/mono-config.h>) makes the link on Windows successful. It
still fails under Linux (see below).
However actually executing mono_config_parse(NULL) blows the executable out
of the water, when executing under Windows. The call is
mono_set_dirs((monoPath + "/lib").c_str(), (monoPath + "/etc").c_str());
and the exception/stacktrace is
Unhandled exception at 0x7c918fea in DataAccessCApiTest.exe: 0xC0000005:
Access violation writing location 0x00000010
[Frames below may be incorrect and/or missing, no symbols loaded for
So of course this means re-building Mono. Once that's done, everything
There are a raft of problems with the embedding APIs that require many
manual changes to get them to work. Have these been fixed in newer code
drops? Specifically, there are edits to threads.h and of course the above.
Many thanks -- I hope this is helpful.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list