I still can't get it to work with Import. As you suggest, I have tried:

use strict; use Win32::API; Win32::API::Type->typedef( 'OMDTEXTZ', 'TCHAR'); Win32::API::Type->typedef( 'OMDERROR', 'ULONG'); Win32::API::Type->typedef( 'OMD32U', 'ULONG' ); Win32::API::Type->typedef( 'OMDCLIENT', 'ULONG' ); Win32::API->Import( 'omdapi', 'OMDERROR OMDClientCreate ( OMDTEXTZ* pUsername, OMDTEXTZ* pPassword, OMDTEXTZ* pDomain, OMD32U options, OMDCLIENT* pClient )' ); my $username = 'user1'; my $password = 'pass1'; my $domain = 'domain1'; my $options = 0; my $client; my $return = OMDClientCreate( $username, $password, $domain, $options, + $client ) or die $^E;

And although the call to OMDClientCreate does not die, it also puts nothing into the $client variable.

However, if I try it using a parameter list instead:

use strict; use Win32::API; my $function = Win32::API->new( 'omdapi', 'OMDClientCreate', 'PPPIP', +'I'); my $client = pack('L', 0); my $username = 'user1'; my $password = 'pass1;; my $domain = 'domain1'; my $return = $function->Call( $username, $password, $domain, 0, $clien +t );

it actually works (which I have confirmed by using Data::Dumper on the $client variable).

Am I missing something?

Thanks,

fx, Infinity is Colourless


In reply to Re^2: Win32::API - How to call an Imported function with Win32::API::Types ? by fx
in thread Win32::API - How to call an Imported function with Win32::API::Types ? by fx

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.