How do I call a function that resides in a DLL from a CMEX DLL?
1 次查看(过去 30 天)
显示 更早的评论
How do I call a function that resides in a DLL from a CMEX DLL?
I am trying to write a CMEX file to call from the MATLAB command line. I have been successful at completing this task in the past. However, this time I am trying to call a function that resides in a DLL and now I am not able to do this.
采纳的回答
MathWorks Support Team
2009-6-27
The general format for linking multiple objects is:
mex circle.c square.obj rectangle.c shapes.lib
NOTE: The MEX command compiles code using the "__cdecl" calling convention. Compiling the dll using the "__stdcall" calling convention.would lead to an error. To get the linking process to work, you need to do two things when compiling your dll:
1) Change the calling convention to "__cdecl" and
2) Export the dll function using the following: extern "C" __declspec(dllexport)
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!