ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using library call nodes

I have attached a simple VI which uses a Call Library Node to open a serial communication port.  When I run this VI, LabView crashes.  I have attached the VI and the dll.  I have verified that the calling parameters are correct for the function.  Can anyone help me understand what is going on or how I can execute this or other CLN's using the same .dll?
 
The source for the .dll is available at the SeaLevel System's website.  The card it is interfacing with is a Route56 PCI CCA P/N 5101.
 
Thank you. 
0 Kudos
Message 1 of 7
(3,449 Views)
I have had this issue ocurr before when I did not pass the correct parameters to the Call Library Function, or I did not specify the correct calling convention.
 
What does the prototype for the function look like?
0 Kudos
Message 2 of 7
(3,433 Views)
unsigned long SEAMAC_PortOpen(unsigned short int DriverType, unsigned short int PortNumber, unsigned long *hDevice);
0 Kudos
Message 3 of 7
(3,431 Views)
Try it with the calling convention set to stdcall. That convention is normally used on windows.

Regards,

Wiebe.
0 Kudos
Message 4 of 7
(3,419 Views)
Thank you for the suggestion.  The VI runs without crashing now.  Can anyone expain why?
0 Kudos
Message 5 of 7
(3,416 Views)

You must use the correct calling convention to prevent stack violation.

Details can be taken e.g. from here.

Regards, Guenter

0 Kudos
Message 6 of 7
(3,410 Views)
To apply this (haven't actually read the link) to your application:


The main difference is that order the inputs are passed is reversed. So in your, the first parameter (a enumerated value) will be used as a pointer (the last input). When the dll code will try to write it's data to this pointer, it will crash.


Regards,


Wiebe.
0 Kudos
Message 7 of 7
(3,401 Views)