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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |