Hi,

As regards Inline::C, you have:
use strict; use warnings; use Inline C => Config => MYEXTLIB => 'd:\path\to\CrappyLibrary.dll', INC => '-Id:\path\to', BUILD_NOISY => 1; use Inline C => 'DATA'; my $result = RegisterClient2($client_id, $S{read_IP}); __DATA__ __C__ #include "Easy4ApiDef.h"
I think you've *nearly* nailed it. To make it work you could probably invoke the help of the 'autowrap' config option ... see the Inline::C docs (I'm not really up to speed with this aspect of Inline::C).

Instead, I would probably do the wrapping myself. Something like:
use strict; use warnings; use Inline C => Config => MYEXTLIB => 'd:\path\to\CrappyLibrary.dll', INC => '-Id:\path\to', BUILD_NOISY => 1; use Inline C => 'DATA'; my $client_id = 5; #numeric my $read_IP = 'whatever'; #string my $result = wrap_RegisterClient2($client_id, $S{read_IP}); __DATA__ __C__ #include "Easy4ApiDef.h" int wrap_RegisterClient2(int cl_id, char* read_ip) { return RegisterClient2(cl_id, read_ip); }
This should work ok with the gcc compiler (no hope at all with M$ compilers, as they can't link to dll's).

Update: And now ... let's check out yesterday's news ...

Cheers,
Rob

In reply to Re: Calling a function form an external DLL with Inline::C on windows by syphilis
in thread Calling a function form an external DLL with Inline::C on windows by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.