-1

I have a win32 dll built using _cdecl calling convention which exported one function as :

extern __declspec(dllexport) char* myfunc(char* param1, char* param2, char* param3, int param4, int param5)

I am calling this function from perl script like this:

sub call_dll {
.....
....

my $api = Win32::API->new( 'my.dll', 'myfunc', 'PPPII', 'P', '_cdecl' );
my $return = $api->Call( $param1, $param2, $param3, $param4, $param5);

....
}

This call is working fine and I am successfully getting return value.

Now, when I am trying to call this "call_dll" function in a perl mutithreaded implementation,the script crashes every time.

I am using active perl 5.16 on Windows7

What can be the reason for this crash? Can't we use win32::api for a threaded implementation?

Kallol
  • 302
  • 4
  • 16
  • 1
    What kind of crash is happening? Is there an error message? What are your params? We need a little more info, please. – simbabque Jul 12 '13 at 13:08

1 Answers1

1

What version of Win32::API are you using? what are the contents of $param1, $param2, $param3, $param4, $param5? What is the real DLL and real function call you are using and what are the docs for that C function?

I think you are passing NULLs for the char *s, or you are messing up the prototype. Or your C function isn't reenterant/thread safe.