Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling user defined C/C++ library functions from Perl 1

Status
Not open for further replies.

natalia2k

Programmer
Sep 5, 2005
8
IN
Hi,

I need to have Perl interface over C++. For this I have a C++ dll, and I want Perl module to include this dll and invoke the exported methods from the dll. I assume that this is possible using XS approach, but I am clueless on how to use an user defined dll with Perl. A sample of the XS code would be of great help.
Another information, this will be done on Windows.

Thanks
 
Best bets on this are 'man perlxs' and 'man perlxstut',
neither of which is light reading.

My eyes glazed well before they hit the bit about AV * and
HV * requiring special handling to avoid memory leaks (some unfixable bug in the typemap file).

Kordaff
 
While I've not done it (my eyes glazed over about the same point with XS), I think using Win32::API is supposed to make calling an arbitrary .dll from windows relatively simple.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
If I use Win32::API, then an XS extension is not required right? I mean the dll can be directly "included" in the Perl script itself?
 
Again, I think so, but I've never done so. Read through the documentation, google for some examples, and try things yourself. If it turns out Win32::API isn't up to the task, then I'm sure some folks here can help you through an XS call.

Do you know much C? If you could write a C program to include and call your dll, and the call isn't very complicated, then XS may not be very difficult at all.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
Umm yeah, I think I better try it out with win32::api and check if it works for a simple dll.

oh yeah i know c . i m basically a c++ person :).. getting into the world of java and perl rite now.

thanx for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top