[rt.cpan.org #90597] module Win::API (0.75) installation failed

[email protected] ("Daniel Dragan via RT") Mon, 25 Nov 2013 11:09:31 -0500
Newsgroups perl.libwin32
Message-ID <[email protected]>
Mon Nov 25 11:09:30 2013: Request 90597 was acted upon.
Transaction: Correspondence added by BULKDD
       Queue: Win32-API
     Subject: module Win::API (0.75) installation failed
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=90597 >


On Mon Nov 25 04:29:47 2013, [email protected] wrote:
> I downloaded the updated version of the the Win32::Api module. All
> tests
> are passed. But I faced other problem. This fragment of the perl code
> does
> not  work now:
> 
> *$jtagConnect = new Win32::API('jtagvsdll', 'jtagConnect','I', 'I',
> '_cdecl');*
> *$jtagDisConnect = new Win32::API('jtagvsdll', 'jtagDisConnect','',
> 'V');#,
> '_cdecl'*
> *$JtagReadMem = new Win32::API('jtagvsdll', 'JtagReadMem','NNP','I',
> '_cdecl');*
> *$JtagWriteMem = new Win32::API('jtagvsdll', 'JtagWriteMem','NNP','I',
> '_cdecl');*
> *$JtagWriteReg = new Win32::API('jtagvsdll', 'JtagWriteReg','NN','I',
> '_cdecl' );*
> *$JtagReadReg = new Win32::API('jtagvsdll', 'JtagReadReg','N','N',
> '_cdecl'
> );*
> *$JtagRun = new Win32::API('jtagvsdll', 'JtagRun', '', '', '_cdecl'
> );*
> *$JtagStep = new Win32::API('jtagvsdll', 'JtagStep', '', '', '_cdecl'
> );*
> 
> But it works perfect in the Cygwin 32-bit environment , with your
> module
> (releases 72,73,74,75).

What are the C prototypes from headers of those functions? What are precise symptoms of "does not work"? new() returns undef? Crash? C function returns failure value (false or non-zero error code)?

Common mistakes are, loading 32 bit DLL into 64 bit process (forbidden by windows), improper pack()ing of structs or machine values for 'P' letter, 'I' (32 bit always) instead of 'N' (32 or 64 bit, AKA pointer size), 'N' instead of 'I' (high 32 bits are not zero). _cdecl has no effect on 64 bit os, because 64 bit Windows has 1 calling convention. Visual C treats all the different 32 bit calling convention as the 1 and only 64 bit calling convention.