Closed flowerlove closed 2 years ago
ill look into adding the calling convetion across the codebase. cdecl is the default normally so ill decorate everything with that. stdcall is not typically used. wont get to this until this weekened. Unless you want to do a PR with changes on the c# side and c code with the cdecl everywhere :)
Added cdcel as the calling convention to the dllimport. cdcel is the default calling convention for c/c++ net default import is stdcall so this should be fixed now. Give it a shot
Nice find!
going to close this. Let me know if this recurrs
My Test Project is .net framework 4.6.1, Win32, When i use C++ dll, exe will crash Crash Info : Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
So I download the code and build, change C/C++->Code Generation->Basic Runtime Checks to Default.But it not work, always crash but no crash info.
so I Check the extern code, i find this code should be:
typedef int(stdcall C_API_MonitorCallback)(Monitor buffer, int buffersize); typedef int(stdcall C_API_WindowCallback)(Window buffer, int buffersize); (as example)
then i rebuild dll, it work fine.