I think I wasn't clear. On your or your client's 64 bit Windows machine, are you running a 32 bit perl or a 64 bit perl? (I think your 64 bit perl because J returned 8 bytes).
In C header files traditionally, if __stdcall isn't written in the function declaration AFTER the C preprocessor (WINAPI and CALLBACK both become __stdcall), it is a __cdecl. MSVC by default is __cdecl and I assume every other Windows 32bit compiler in the world is. I've never see an actual use of the command line switch used to switch the default from cdecl to stdcall in my life
Try
# Load the function.
my $LoadTableFromFile = new Win32::API("myDll.dll","myTableLoadFromFil
+e", 'PP', 'I', '_cdecl');
At this point, 32 or 64, it doesn't matter, since I am running low on ideas. You must use '_cdecl' exactly that way, a typo in 0.68 means '__cdecl' and 'cdecl' become stdcall.
I am starting to think your DLL has problems and its not a problem with API. Does the DLL actually work if you write C code for it? Googling "ctbl_v2.dll" returned nothing so its something private you have.
Next idea, now I'm shooting in the dark, can you tried changing
my $pathATable = 'C:/Temp/Requests/testTable.TBL';
to
my $pathATable = 'C:\Temp\Requests\testTable.TBL'; #no ""s
?
Another idea, lets assume there are secret members after opaque, change
# pack the table.
my $packedaTable = pack('J',$aTable);
print Dumper($packedaTable);
if(unpack('J',$packedaTable) == $aTable)
{print "I know how to pack this table.\n";}
else
{die "I dont know how to pack this table";}
to
# pack the table.
my $packedaTable = pack('J',$aTable);
print Dumper($packedaTable);
if(unpack('J',$packedaTable) == $aTable)
{print "I know how to pack this table.\n";}
else
{die "I dont know how to pack this table";}
$packedaTable .= "\x00" x 100000000; #100MB allocation
48120353 sounds like a reasonable memory pointer. Hmm, when you say "What I get it's the famous "Segmentation fault (core dumped)".", are you on Windows or on Linux? Windows doesn't have "Segmentation faults" it has "access violations".
The string "Segmentation fault" isn't even in Perl. Assuming your using Windows, have you clicked the "To see what data this error report contains click here" thing and then "view technical information", and looked where the crash happened and if it happened in your private DLL or not?
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.