Re: calling ' extern "C" int __declspec(dllexport) ' declared functions?

Mark McMahon <[email protected]>
Newsgroups gmane.comp.python.ctypes
Message-ID <36FA17CA56D6A84D9E422A359CB4F04770962262F8@ADSK-NAMSG-02.MGDADSK.autodesk.com>
Hi Ray,

The __declspec(dllexport) should not really impact things.

# can you get a reference the DLL
dll = ctypes.windll.YOURDLLNAME

Can you get references to the functions...
SetBlockSize = dll.SetBlockSize  #using SetBlockSize is easier as the argument is a plain int

ret = SetBlockSize = SetBlockSize(123)

# does ret have the return code for success (or expected return value?)

For GetBlockSize - you will need to read the doc and see what to do with pointer/reference values :)  (but usually ctypes.byref(var) or ctypes.pointer(var) are what you need).

Thanks
  Mark



From: RJ [mailto:[email protected]] 
Sent: Friday, August 13, 2010 6:17 AM
To: [email protected]
Subject: [ctypes-users] calling ' extern "C" int __declspec(dllexport) ' declared functions?

I am trying to access a win32 DLL with functions declared in the .h like this:
extern "C" int __declspec(dllexport) GetBlockSize( int& iBlockSize );
extern "C" int __declspec(dllexport) SetBlockSize( int iBlockSize );
extern "C" int __declspec(dllexport) GetData( int iChannel, float* rData );    

and I'm not getting anywhere. How do I call these three?

-Ray

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.