Re: create win32 dll with multiple export functions

Mark McMahon <[email protected]> Sun, 25 Sep 2011 03:57:00 +0000
Newsgroups gmane.comp.python.pyrex
Message-ID <1FE3E26CC0B45741B13A8157598BB99C070EFF@005-TK5MPN1-013.MGDADSK.autodesk.com>
Hi,

Something like the following should work.
cdef public void testFunc():
	.....

cdef + public =3D function exported from resulting exe/dll.

Use 'depends' (http://www.dependencywalker.com/) to validate that you do ac=
tually 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?) man=
gle 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: [email protected] [mailto:[email protected].=
no] On Behalf Of Jan
Sent: Sunday, September 25, 2011 2:29 AM
To: [email protected]
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 unders=
tand that
__declspec(dllexport) directive is declared for the main function only. I n=
eed 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 d=
ll 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 =
=3D wcslen(s); for(int i=3D0; i<len>>1;i++) { wchar_t temp =3D s[i]; s[i] =
=3D s[len-i-1]; s[len-i-1] =3D temp; } }

__declspec(dllexport) FVector* CallDLL2(float x, float y, float z) { static=
 FVector result; // declared static so that the struct's memory is still va=
lid after the function returns.
result.x =3D x;
result.y =3D y;
result.z =3D z;
return &result;
}

thank you for help.....Jan


_______________________________________________
Pyrex mailing list
[email protected]
http://lists.copyleft.no/mailman/listinfo/pyrex