
perl_rookie
New User
Nov 28, 2010, 8:37 AM
Post #1 of 1
(14889 views)
|
import c++ dll: problems with pointer
|
Can't Post
|
|
Hello, maybe somebody can help me with the following problem: Iīve got a c++ dll with the api function int recvData(char* p_buffer, int size), which fills a buffer with chars. (the api function has already worked, if you call from a c++ project) Now I want to import the dll in perl. Therfore I wrote the following perl code: #dll_test.pl################################################ use Win32::API; my $recv = new Win32::API('mydll', '_recvData@8','PI','I'); #this is not a link, could not formate it if(not defined $recv) { die "Canīt import API recvData: $!\n"; } else { my $size = 8; my $buffer = "\x00" x $size; my $p_buffer = unpack('L', pack('P', $buffer)); $recv->Call($p_buffer, $size); } ############################################################ The Win32::API call works, the function $recv executes, but $buffer is still empty. Does someone know whatīs wrong? thanking you in anticipation
|