开发者

Exported function names does not contain argument list

I'm creating a plugin DLL using c++ in Eclipse.

When trying to load the plugin I get an error:

?CTC_Cleanup@YAXXZ not found. Function is not available in myplugin.dll

When comparing another working plugin with my plugin using Dependency Walker I notice that the function name in the other plugin is: "void CTC_Cleanup(void)", enabling "Undecorate C++ functions" => "?CTC_Cleanup@YAXXZ".

In my plugin the function name is: "CTC_Cleanup", enabling "Undecorate C++ functions" makes no difference.

My C++ function declarations in the .h file are all decorated with "__declspec(dllexport)" and surrounded using

extern "C" {
...
...
...
}开发者_运维技巧

/Kristofer


It's looking for a mangled name, so you don't want extern "C".

?CTC_Cleanup@YAXXZ is using the VC++ name mangling for a function taking void and returning void named CTC_Cleanup.

However, you are using g++ 3.x or 4.x, and g++ uses a different mangling scheme that is incompatible.

Build your library using VC++, or else figure out how to make g++ use VC++ name mangling.


Argument names (actually argument types, the formal names really shouldn't matter at this level) shouldn't matter using C linkage; in C, you don't have any overloading so the function name itself should be enough, the types of the arguments don't matter.


Remove extern "C", then it should work: I guess your plugin will then export the function under the expected name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜