I'm getting a crash on the last line of the following Win32::API Call to a National Instruments driver DLL.

# Working Equivalent in C # uInt32 data=0x00000000; # int32 written; #DAQmxWriteDigitalU32(taskHandle,1,1,10.0,0,&data,&written,NULL) #int32 __CFUNC DAQmxWriteDigitalU32 (TaskHandle taskHand +le, int32 numSampsPerChan, bool32 autoStart, float64 timeout, bool32 +dataLayout, const uInt32 writeArray[], int32 *sampsPerChanWritten, bo +ol32 *reserved); my $functionDAQmxWriteDigitalU32 = Win32::API->new('nicaiu','DAQmxWrit +eDigitalU32','IIIFIPPP','I','_cdecl'); my $numSamps = 1; #int32 my $autoStart = 1; #bool32 my $timeout = 10.0; #float64 my $GroupByChannel = 0; #bool32 my $writearray = pack ('N4',0,0,0,0); my $sampsPerChanWritten= pack("N4",0,0,0,0); my $reserved = 0; # NULL * $return = $functionDAQmxWriteDigitalU32->Call($outTaskHandle,$numSamps +,$autoStart,$timeout,$GroupByChannel,$writearray,$sampsPerChanWritten +,$reserved);

Previous function calls using the outTaskHandle are working fine, I'm pretty sure the problem is in the $writearray parameter (which I need to set to some hex value like 0xF7), the $sampsPerChanWritten which is modified by the C function, or the $reserved pointer which is supposed to be NULL. I've tried many different assignments to $writearray and $sampsPerChanWritten with no luck.

I'm new to Perl, Win32::API and perlmonks so I apologize for formatting issues.


In reply to Win32::API pointers / NULL by ghardy

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.