C#.Net中使用的Borland Builder 2006 DLL-System.StackOverflowExcep
Borland Builder 2006 DLL used in C# .Net - System.StackOverflowException
我有一个旧的DLL(Borland Builder 2006 C++),我想在.Net C#Visual Studio 2010中使用它。当我试图在VS中导入函数时,我总是从Visual Studio中得到StackOverflowException。我已经读了很多东西,导入似乎很容易。但我失败了,没有看到我的错误。
在Borland DLL中,函数导出为:
__declspec(dllexport) void TestFunc1()
或extern "C" __declspec(dllexport) void __stdcall TestFunc2()
修饰的名称是(使用impdef创建的*.DEF文件,并使用依赖项walker进行验证):
@TestFunc1$qqsv
TestFunc2
在Visual Studio中,我以这种方式导入:
[DllImport("MyDllName.dll", EntryPoint = "@TestFunc1$qqsv", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall, CharSet = CharSet.Auto, SetLastError = true)]
public static extern void TestFunc1();
[DllImport("MyDllName.dll",CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall, CharSet = CharSet.Auto, SetLastError = true)]
public static extern void TestFunc2();
在展台的情况下,当我调用时,会从Visual studio获得StackOverflowException
MyImport_Unmanaged.TestFunc1()
或MyImport_Unmanaged.TestFunc2()
怎么了?有人能帮我吗?
有趣的是,当我导入一个用Visual Studio C++创建的旧dll时,函数的修饰名称是:_TestFunc1@0
。这个名字与Borland的名字大不相同,但却是可行的。
正确的语法是:extern"C"void__stdcall__declspec(dllexport)TestFunc1()
我也遇到了同样的问题。经过大量的实验,我意识到这个问题不是语法问题。事实上,C++Builder DLL使用的是VCL窗体。我去掉了表格,一切都好了。
相关文章:
- TDateTime格式在C++Builder中不会更改
- C++Builder中的OnClick事件签名存在问题
- 在Embarcadero C++ Builder中生成的DLL未解决的外部链接错误
- 是否允许调用方对我的 Builder 类使用任何指针类型(包括智能指针)?
- 在 C++ Builder 中使用 NULL 构造 DynamicArray
- Implementing Active Directory with C++ Builder
- BEGIN_MESSAGE_MAP导致C++Builder 10.1崩溃到桌面
- 函数模板"Builder"
- 使用 C++Builder 项目读取字符串中的文件时出错
- 如何在 c++builder 中使用 IDE 管理的组件编写for_each循环
- 如何确保Win-Builder用C 11构建我的包裹
- 在Borland 2006中创建TAnimate
- C++BUILDER OnVirtualKeyboardShown和OnVirtualKeyboard Hidden从另
- Borland C++Builder 6 Strings操作太慢
- 事件处理程序是Embarcadero C++Builder中的重入程序吗
- C++ Builder 10.2: Thread blocks WaitForInputIdle
- COCI 2006 竞赛 #1 债券任务说明
- LLVM builder::GetInsertBlock,这个函数的目的是什么?
- C#.Net中使用的Borland Builder 2006 DLL-System.StackOverflowExcep
- 无法在C++Builder 2006中编译应用程序清单的资源