This reminds me of similar struggles that I had about a year ago. I posted a question about my situation (How to use Win32::API to access variable in DLL file?) and got very useful help from BrowserUk about how accomplish what I wanted using just the Win32 module. You might want to check it out to see if the information there might help you get started.

Of course, that was dealing with variables. For functions, you would use Win32::API. The combination of the post linked above and some sample code below might help get you going in the right direction.

use strict; use Win32::API; # Load the DLL my $dll = Win32::LoadLibrary('CrappyLibrary.dll') || die $^E; # Import the function my $func = new Win32::API('CrappyLibrary.dll','RegisterClient2','PP',' +I'); if (not defined $func) {die "Unable to import 'RegisterClient2' functi +on.\n";} my $client_id = 1; my $ip_addr = "192.168.1.1"; # Call the function my $value = $func->Call($client_id,$ip_addr); # unload DLL Win32::FreeLibrary($dll);

Hope this helps!


In reply to Re: Calling a function form an external DLL with Inline::C on windows by dasgar
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.