Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

shared library: function is not found and recognized in header file

Hello,

I am trying to use Java methods into LV. I am doing so by creating Java Invocation Interface, usind which I can call Java methods into C++ and then create a shared library that can be called into LV.

When I am importing my shared library into Labview, I am getting the following error messages. My guess is that LV is not able to recognize the header files.

"

The shared library contains 3 function(s). But no function is found and recognized in the header file. The following function(s) cannot be wrapped. If you want to import these functions, please review the warning messages next to the functions below. You will need to fix the problems before you can continue with the wizard.

jclass invokeJavaClass(JNIEnv* jenv, string className);

The following symbols are not defined:
jclass;

Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add preprocessor definitions. Click the Back button to return to the previous page of the wizard to add a preprocessor definitionsl (for example, "NIAPI_stdcall = __stdcall" or "NIAPIDefined = 1").

The following header file was not found in the specified header file or one of the referenced header files:
-  string
-  iostream
-  cstring
-  jni.h

To fix, click the Back button to go to the previous page and add the header file path to the Include Paths list.

"

Please advise.

Regards,

H

SharedLibError.png

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

The library import wizard is a fairly good C Preprocessor parser but certainly not a fully fledged one. It will and does stumble over complicated declarations in header files. jclass being most likely defined as a class certainly will make the parser trip as it does only understand standard ANSI C and none of the various C++ extensions.

Also you seem to not have configured the wizard with respect to where it should find your system headers. While C compilers often come with their own system headers and therefore know where they should be installed, is the import library wizard simply a(n amazing) multiplatform tool that you have to configure to your platform.

Last but not least just because the import library wizard chokes on your header file and/or shared library does not mean you can't import that shared library at all. It just means that you can't let LabVIEW do all the work. You can create a Call Library Node manually and configure it for the function. Since you wrote the shared library you should have enough C datatype understanding to make that happen successfully. Just make sure to understand that the Call Library Node is not meant to do anything but calling exported functions. So anything that is not a function and whose parameters can not be somehow abstracted to standard C datatypes is a complete nogo already. And no, C++ objects as functon parameters do not necessarily have to be an obstacle. As far as C is concerned that can be treated simply as a pointer to some memory, whose layout is absolutely opaque to the C compiler (and in our case to LabVIEW).

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,877 Views)