Questions tagged «name-decoration»

4
使用dllexport从DLL导出功能
我想要一个从C ++ Windows DLL导出函数的简单示例。 我想查看标题,.cpp文件和.def文件(如果绝对需要)。 我希望导出的名称没有修饰。我想使用最标准的调用约定(__stdcall?)。我想要使​​用__declspec(dllexport),而不必使用.def文件。 例如: //header extern "C" { __declspec(dllexport) int __stdcall foo(long bar); } //cpp int __stdcall foo(long bar) { return 0; } 我试图避免链接程序在名称中添加下划线和/或数字(字节数?)。 我可以不支持dllimport并dllexport使用相同的标头。我不需要有关导出C ++类方法的任何信息,而只希望获得c样式的全局函数。 更新 不包括调用约定(并使用extern "C")会为我提供我喜欢的导出名称,但这意味着什么?是什么默认的调用约定我得到了什么pinvoke(.NET),声明(vb6)并GetProcAddress可以预期?(我猜GetProcAddress这取决于调用者创建的函数指针)。 我希望此DLL在没有头文件的情况下使用,因此我真的不需要花哨的钱就#defines可以使调用者使用该头。 我可以接受的答案是,我必须使用*.def文件。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.