"$Bill Luebkert" <[EMAIL PROTECTED]> wrote on 07/22/2005 07:19:56 PM:
> David Legault wrote:
>
> > Hello,
> >
> > I'm trying to use the Win32:API module to access a DLL function with
> > this perl code :
> >
> > $function = Win32::API->new( 'test.dll', 'int startSimulation(int
> > eRunMode)', );
>
> Try an alternate calling method and see if it makes a diff :
>
> my $function = Win32::API->new('test.dll', 'i', 'i') or die
> "import: $! ($^E);
> my $return = $function->Call(0);
>
> or
>
> my $startSimulation = Win32::API->Import('test.dll',
> 'int startSimulation (int eRunMode)') or
> die "import startSimulation: $! ($^E)";
> my $return = startSimulation (0);
>
> print "$return\n";
>
>
> > $return = $function->Call(0);
> > print $return;
> >
> > The C code for the function in the DLL is :
> >
> > int startSimulation( int eRunMode ) {
> >
> > return 0;
> > }
> >
> > Which is very basic and the Symbol is exported with a .def file.
> >
> > When I run the perl code, it crashes with a pointer to NULL memory
access.
> >
> > If anyone has a clue on why this is happening, or has a fix for it,
I'd
> > be glad to know.
> >
> > P.S. I also tried WJ patched version available at
> > http://www.xs4all.nl/~itsme/projects/perl/ with the same result.
I experienced a similar problem with accessing a vendor DLL from Perl. The
cdecl calling convention was the culprit and using
http://www.xs4all.nl/~itsme/projects/perl/ Win32::API package resolved it.
If you provide the DLL (or at least a makefile), I'm willing to try to
access it from Perl.
Lloyd
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs