in reply to Re: Calling a function form an external DLL with Inline::C on windows
in thread Calling a function form an external DLL with Inline::C on windows

It turns out that my entire trip to Inline-land was useless1, because Win32::SerialPort doesn't work for some reason if I use it.

However, I tried Win32::API again as a last resort, and it turned out that it works (and it doesn't crash) if and only if I import the functions like this:

my $RegisterClient2 = Win32::API->new($DLL, 'RegisterClient2', 'PP', ' +I', '_cdecl');

So my DLL was compiled with the _cdecl convention, and that's why it failed earlier.

1) not entirely useless, because I used to think that I can't use Inline on Windows at all. Now that I saw that it works, I have plans to rewrite some of the speed-critical parts of my earlier applications.

2) I agree that the DLL writer's version of Hungarian notation is confusing, but I can't do anything about it. I decided to go with it to stay in sync with the docs.
  • Comment on Re^2: Calling a function form an external DLL with Inline::C on windows
  • Download Code