Intermittent Access Violation when using C# to access C++ DLL

时间:2015-05-08 10:04:40

标签: c# c++ dll

I'm linking from c# to a quite complex c++ dll. I need to create a lot of dllexport funtions so I can use the dll in c#. To get started, I added a .cpp file and created a simple test function:

c++:

<meta charset="UTF-8">

c#:

<head>
    <meta charset="UTF-8">
    <!-- Styles, Javascript and other things go here -->
</head>

This test works perfectly 90% of the time and then suddenly....

extern "C" __declspec(dllexport) int32_t Test(){
    return 10;
}

Everything seems fine, no idea what causes it or even how to begin to track down the problem. It's weird that it is so intermittent. I'm not a c++ programmer really so I've no idea what might cause this behaviour, or even how to debug and find the problem.

Hope some kind soul can help.

0 个答案:

没有答案