fx has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to call a function within a DLL using Win32::API and am trying to do using Import and prototypes.
The parameters required by the function are all custom types, and so after reading the C header files and Win32::API::Type I have defined these types and Imported the function:
use strict; use Win32::API; Win32::API::Type->typedef( 'OMDTEXTZ', 'TCHAR'); Win32::API::Type->typedef( 'OMDERROR', 'ULONG'); Win32::API::Type->typedef( 'OMD32U', 'ULONG' ); Win32::API::Type->typedef( 'OMDCLIENT', 'ULONG' ); Win32::API->Import( 'omdapi', 'OMDERROR OMDClientCreate ( OMDTEXTZ* pUsername, OMDTEXTZ* pPassword, OMDTEXTZ* pDomain, OMD32U options, OMDCLIENT* pClient )' ); ## my $return = OMDClientCreate( "OMG, I am so confused!" );
My question is: how am I supposed to call OMDClientCreate? When the C function wants a OMDTEXTZ* do I simply give it a Perl string? What about when it wants a OMDCLIENT* to return me the client handle?
I have found little to no documention in either Win32::API or Win32::API::Type to explain how this is done.
Thanks,
fx, Infinity is Colourless
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::API - How to call an Imported function with Win32::API::Types ?
by BrowserUk (Patriarch) on Jul 01, 2004 at 18:03 UTC | |
by fx (Pilgrim) on Jul 02, 2004 at 08:26 UTC | |
by BrowserUk (Patriarch) on Jul 02, 2004 at 08:37 UTC | |
by fx (Pilgrim) on Jul 02, 2004 at 11:24 UTC | |
by fx (Pilgrim) on Jul 02, 2004 at 11:29 UTC | |
| |
|
Re: Win32::API - How to call an Imported function with Win32::API::Types ?
by vladdrak (Monk) on Jul 02, 2004 at 02:35 UTC | |
|
Re: Win32::API - How to call an Imported function with Win32::API::Types ?
by chinman (Monk) on Jul 02, 2004 at 13:14 UTC |