You should be able to figure it out yourself, on a x86-32 Perl, pack letter for pointer is V or L. Since a pointer is a 32 bit little endian number. J is the way I write "portable" code, since its 32 on 32 and 64 on 64, except when you have a non standard 32 bit perl with "quads"/"native 64 bit" support, which is what I think you have. Some people think that a 32 bit perl with "quads"/"native 64 bit" is a long overdue feature of perl so its not a bad thing. I would replace all the pack 'J's with pack 'L's or pack 'V's.
You might want to put this in, its how Win32::API figures out what the pack letter for a pointer is
#const optimize
BEGIN {
use Config;
eval ' sub pointer_pack_type () { "'
.($Config{ptrsize} == 8 ? 'Q' : 'L').
'" }';
}
then do something like
$packednum = pack( pointer_pack_type() , 123456);
I still would like to see a Dumper() of the parameters you passed to myTableCompare. About your DLL, do you have the source code to it or not? If you have the source code for that DLL you can use a C debugger with symbols, you could figure out in about a minute why it crashed. Even without the source code to that DLL, you can figure out if it crashed inside the DLL, or Win32::API/Perl crashed from C stack corruption (the latter only happens with stdcall functions, cdecls very very rarely corrupt the C stack, but they may see garbage parameters if they are prototyped incorrectly by the caller, a wrong prototype with a stdcall is 100% fatal). Most MS DLLs, the C functions always "validate" their parameters, with
SEH or
IsBadReadPtr and friends, so when you pass a NULL ptr, or a "(char *)1234", they fail with GLR=ERROR_INVALID_PARAMETER, they
DONT crash. Non-MS DLLs, its upto the programmer of that DLL on what to do, usually they don't do what MS does and simply crash.
If it works in C, its guaranteed that, somehow, someway, Win32::API my non-CPAN 0.69-0.71 will work. I say my non-CPAN versions because 0.68 for example, if the return type is a float, the C function is never called (bug in 0.68). If you want to see pushing Win32::API 0.68 to its limits (calling MS COM object "C++" methods), look at this thing I wrote,
use C++ COM objects without any compiler, I had to runtime replace the insides of Win32::API 0.68 to pull it off.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.