Re: Shared Linux libraries in LabView 7.1

Raistlin wrote:We are trying to transfer
a rather large application from Windows to Linux. The major problem I
seem to encounter is the use of shared libraries. We wrote a large part
of our software in C, but when I try to make a shared library I do not
succeed to export the functions. A first simple test file (with a
meaningless little function) already gave the problem of not exporting
the function in the shared library to LabVIEW. Not only are the
functions not listed when configuring the Call Library Function node,
typing the function name and providing the right arguments still gives
the message that the function was not found. The source code was the following : long first(long a); long first(long a) {   long b;   b = a;   return b; } The command :  gcc -fPIC -shared -o firstso.c
Are any extra compilation flags or keywords required ? I already tried
a whole bunch (including visibility attributes), but the problem
remains the same.
I can't give you the solution here, but there are several issues with shared library function export.

First only on Windows does the Call Library Node have support to
enumerate the exported functions and populate the Ring Control. On all
other platforms this Ring Control is always disabled.

There are ussues about name decorations and such when compiling a C
source file with a CPP compiler. Also I've had quite some troubles in
the past to get a shared library to export its functions and fiddling
with the make file eventually made the functions available for LabVIEW
to call.

My command lines usually look somewhat like this if I remember correctly, although I usually use makefiles for this:

gcc -fPIC -I. -O3 libtest.o libtest.c
gcc  -shared -Wl, -o libtest.o

Rolf Kalbermatter