CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Win32 Programming Help:
Pointer parameter to a mapped C dll function


New User

Apr 24, 2008, 6:40 AM

Post #1 of 2 (7508 views)
Pointer parameter to a mapped C dll function Can't Post


I'm a new Perl programmer and I'm using the Win32::API module to use functions of a C dll.
I'm using ActivePerl 5.8.8.

Here is the C code of the function I need to use:
const char* DecodeSomething(GUInt64 time, GUInt16 msgId, GUInt16 bodyLength, GUInt8 dxpNum, GUInt8* bodyData);

So I mapped this function in Perl like this:
$decodeSomething = Win32::API->new($dll, 'DecodeSomething', 'IIIIP', 'P');

And I try to use it like this:

$data = [0x03, 0x00, 0x13, 0x15, 0x3B];
$decodedRecord = $decodeSomething->Call(0xB4B65BBB, 0x0F, 0x20, 0x1, $data);

But running this code raise a "Perl command line interpreter error'.

I think that the error is related to passing a char pointer and/or receiving a char pointer. I am not sure if my Perl translation of the C function header is correct: $decodeSomething = Win32::API->new($dll, 'DecodeSomething', 'IIIIP', 'P');, especially using the P parameter type.
Note that using other functions in this dll with only integer parameters works just fine.

Any hint would be greatly appreciated.

Thanks in advance for your help.


Apr 24, 2008, 11:30 AM

Post #2 of 2 (7505 views)
Re: [gwampach] Pointer parameter to a mapped C dll function [In reply to] Can't Post

I have no experience with what you are doing and I have never seen that error message. I suggest you ask on if you have not already. If you get a reply that explains the problem please post back here.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives