Thursday, April 21, 2011

How do you write a Module Definition File in Visual C++ ?

Here is the code for my head file...

#pragma once
#pragma unmanaged

__declspec(dllexport) public void CallMe(wchar_t *p);

Here is all the code SO FAR for my definition file...

LIBRARY "CppWrapper"

My "CallMe" function's name compiles to "?CallMe@@YAXPA_W@Z". What do I need to add/write in my .def file to correct the compiled name to "CallMe". Also, are there any other steps (or gotchas) I should be aware of?

From stackoverflow
  • You need an extern "C" { } block around your definitions to avoid the C++ name mangling.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.