[Pyrex] create win32 dll with multiple export functions
Mark McMahon
mark.mcmahon at autodesk.com
Sun Sep 25 05:57:00 CEST 2011
Hi,
Something like the following should work.
cdef public void testFunc():
.....
cdef + public = function exported from resulting exe/dll.
Use 'depends' (http://www.dependencywalker.com/) to validate that you do actually have functions exported.
It _MAY_ possibly be necessary to create a .def file to force the exported function to be a specific name (some calling conventions, other stuff?) mangle the names slightly (leading underscores usually).
I know it works - I have done it :)
If you are still stuck after trying the above - let me know and I will see how I can help.
Thanks
Mark
-----Original Message-----
From: pyrex-bounces at lists.copyleft.no [mailto:pyrex-bounces at lists.copyleft.no] On Behalf Of Jan
Sent: Sunday, September 25, 2011 2:29 AM
To: pyrex at lists.copyleft.no
Subject: [Pyrex] create win32 dll with multiple export functions
Hello,
Could someone please tell me, if it is possible to create classic win32 dll with multiple export functions with Pyrex? From what I have read, I understand that
__declspec(dllexport) directive is declared for the main function only. I need to bind that dll to language called unrealscript, where you could bind win32 dll's. Here is a sample from unrealscript documentation of how thee dll should be written in C.
extern "C"
{
struct FVector
{
float x,y,z;
};
__declspec(dllexport) void CallDLL1(wchar_t* s) { MessageBox(0, s, L"Inside the DLL: CallDLL1", MB_OK); // reverse the out parameter string int len = wcslen(s); for(int i=0; i<len>>1;i++) { wchar_t temp = s[i]; s[i] = s[len-i-1]; s[len-i-1] = temp; } }
__declspec(dllexport) FVector* CallDLL2(float x, float y, float z) { static FVector result; // declared static so that the struct's memory is still valid after the function returns.
result.x = x;
result.y = y;
result.z = z;
return &result;
}
thank you for help.....Jan
_______________________________________________
Pyrex mailing list
Pyrex at lists.copyleft.no
http://lists.copyleft.no/mailman/listinfo/pyrex
More information about the Pyrex
mailing list