LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exception with external code

Hello,

 

I'm interfacing with a supplied DLL written in C++. There are tenst of functions in the DLL and all of them work as expected except one that generates the exception. Note that the test application supplied with the DLL executes this function as expected, only when called by LabView the exception occurs.

 

The function prototype as shown in the "configue..." of the call node looks as expected:

unsigned char BTCW_HCI_ReadToolVersionInfo(unsigned long handle, unsigned char *tBTCW_ToolVerInfo);

 

 

Details:

System: LabView7.1, Window XP

Error message: "LabVIEW: An exception occurred within the external code called by a Call Library Node. This might..."

Call convention: WINAPI

 

The knowledge databse indicates that this problem existed for LabView 6 but fixed for 7.

 

Any ideas?

 

Thanks... Yaron 

0 Kudos
Message 1 of 4
(2,553 Views)

If the DLL is written in C++ I don't understand why you are using the WINAPI calling convention. Was the DLL explicitly written to use that convention? Normally you would use C calling convention unless you're ...  calling a Windows API function.

 

My guess is that you are not preallocating the memory for *tBTCW_ToolVerInfo. If you post your code or at least a screenshot a more precise answer can be provided.

0 Kudos
Message 2 of 4
(2,546 Views)

I would assume that the DLL was written for that interface, as all the other functions work as expected. I also tried this specific funtion with both convenstions with the same result.

 

I'm allocating more than enough memory (the function returns 24 bytes and I'm allocating 100)

 

I'm attaching screen shots of the calling vi and the call node configuration dialog.

 

Again, what puzzles me is:

- all the functions in the DLL work with the supplied application

- all the functions except this one work the same kind of interface within my code

 

Thanks... Yaron

Download All
0 Kudos
Message 3 of 4
(2,537 Views)
This may not matter, but have you tried simply setting the "Type" for that parameter to "String" rather than "Array" and then using the Type Cast function to cast the array to a string?
0 Kudos
Message 4 of 4
(2,520 Views)