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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
import c++ dll: problems with pointer

 



perl_rookie
New User

Nov 28, 2010, 8:37 AM

Post #1 of 1 (11166 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

 
 


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

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