Calling a function from a win32-DLL in perl
am 27.12.2007 13:17:36 von Tom GurHi,
How can I, within a perl script, call a certain function from a win32
DLL file ?
Thanks,
Tom
Hi,
How can I, within a perl script, call a certain function from a win32
DLL file ?
Thanks,
Tom
On 2007-12-27 07:17:36 -0500, Tom Gur
> Hi,
>
> How can I, within a perl script, call a certain function from a win32
> DLL file ?
>
> Thanks,
> Tom
use Win32::API;
--
-kira
On Dec 27, 3:20 pm, Kira Yamato
> On 2007-12-27 07:17:36 -0500, Tom Gur
>
> > Hi,
>
> > How can I, within a perl script, call a certain function from a win32
> > DLL file ?
>
> > Thanks,
> > Tom
>
> use Win32::API;
>
> --
>
> -kira
Is there a way to do it using standard perl modules (without adding
modules) ?
Quoth Tom Gur
> On Dec 27, 3:20 pm, Kira Yamato
> > On 2007-12-27 07:17:36 -0500, Tom Gur
> >
> > > How can I, within a perl script, call a certain function from a win32
> > > DLL file ?
> >
> > use Win32::API;
IIRC this only works for __stdcall functions, which applies all the
Win32 API functions in e.g. user32.dll, but not to ordinary C functions
exported from DLLs. These can only be called by using XS; the Inline::C
module provides a convenient way to wrap them if you don't want to write
XS, but it requires a C compiler. In principle chromatic's P5NCI ought
to be a good solution, but it doesn't work under Win32 yet.
> Is there a way to do it using standard perl modules (without adding
> modules) ?
Well, in *principle* you could use Dynaloader directly, but passing the
arguments and retrieving the return value would be well-nigh impossible.
Win32::API is installed with both ActivePerl and Strawberry Perl, so all
Win32 perl installations should include it.
Ben