Home: Perl Programming Help: Win32 Programming Help:
Perl error when calling native dll

New User

Aug 30, 2010, 1:16 PM

Views: 10034
Perl error when calling native dll

I'm new to perl. I'm sure I'm just doing something silly. I hope someone will be kind enough to point out what I'm doing wrong.

Here's my perl code:

#!/usr/bin/perl -w 
use strict;
use Win32::API;

sub Init
my $reprise = Win32::API->new('rlm', 'rlm_init', 'P', 'N');
my $handle = $reprise->Call('.');



Here is the method I'm trying to call:

extern struct rlm_handle *	rlm_init(const char *, const char *,  
const char *);

I've tried passing one parameter, two, all three...same output.
When it runs the "Call" line I get an event log entry like this:

Faulting application name: perl.exe, version:, time stamp: 0x48bef0d8 
Faulting module name: perl510.dll, version:, time stamp: 0x48bef0d7
Exception code: 0xc0000005
Fault offset: 0x00047daa
Faulting process id: 0xe80
Faulting application start time: 0x01cb487c07ea0010

If I try to debug using Visual Studio it gives me this:

Unhandled exception at 0x28047daa in perl.exe: 0xC0000005: Access violation writing location 0x00000004.

The publisher of the dll I'm calling has never used it from perl and is unable to provide assistance. What am I doing wrong?