LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calling function that returns a void pointer using mathscript

Is it possible to call a dll library function that returns a pointer using mathscript? I get the following error when I try it.

 

"Error in function calllib at line 3.  You cannot call shared library functions with numeric pointer return types from MathScript."

 

Partial script is shown below. It loads the library ok. The function 'Pri_Create' returns a pointer to void. Matlab has the function 'libpointer' for declaring a void pointer. Is there anything similar in mathscript?

 

p = 'c:\pri\lib\include'
loadlibrary('pri', 'pri.h', 'alias', 'BV', 'includepath', p);
s = calllib('BV','Pri_Create'); 

 

Appreciate any help...

 

Dan

0 Kudos
Message 1 of 3
(2,540 Views)

Hello,

 

Unfortunately, the MathScript calllib function doesn't support functions that return void pointers. You can find a list of datatypes that this feature supports in the help topic entitled C Data Types in LabVIEW MathScript. 

 

One possible workaround is to write a wrapper function in your DLL that converts the data into a format that MathScript does support. Another possible workaround is to call your function using the Call Library Node in LabVIEW. Which of these would work best depends on how you need to interpret the void pointer.

 

Jesse 

0 Kudos
Message 2 of 3
(2,530 Views)
I was afraid of that. Thanks for your help.
0 Kudos
Message 3 of 3
(2,511 Views)