[Gretl-users] Using the libgretl shared library in C++

Allin Cottrell cottrell at wfu.edu
Thu Apr 30 15:44:26 EDT 2009


On Thu, 30 Apr 2009, Ganguly, Sunandan wrote:

> Has anyone out there ever tried to use the api-s within the shared
> library from inside a C++ program?

No, but...

> I get this linker error :
>
> /app/devtools/gcc-4.3.3/bin/g++ -m64 -mtune=opteron -lpthread  Main.o
> -L/app/devtools/gretl-1.8.0.org/lib -lgretl-1.0
> -L/app/devtools/zlib-1.2.3/lib -lz -L/app/devtools/libxml2-2.7.3/lib
> -lxml2 -L/app/devtools/glib-2.14.6/lib -lglib-2.0
> -L/app/devtools/refblas3-3.0-11/lib64/libblas.so.3.0.0
> -L/app/devtools/liblapack3-3.2.0-5/lib64/liblapack.so.3
> -L/app/devtools/fftw-3.2.1/lib -lfftw3
> -L/app/devtools/gcc-4.3.3/lib64/libgfortran.so.1 -o Application.x
> /app/devtools/gretl-1.8.0.org/lib/libgretl-1.0.so: undefined reference
> to `dgecon_'

What does

nm /app/devtools/liblapack3-3.2.0-5/lib64/liblapack.so.3 \
 | grep dgecon

show?  That symbol should be defined in liblapack.  Also, what
does

ldd /app/devtools/gretl-1.8.0.org/lib/libgretl-1.0.so

show?  That library should be linked against liblapack.

On my system:

waverley:~$ nm /usr/lib/liblapack.so.3 | grep dgecon
0016fca0 T dgecon_

waverley:~$ ldd /opt/esl/lib/libgretl-1.0.so
        linux-gate.so.1 =>  (0xb7f28000)
        liblapack.so => /usr/lib/liblapack.so (0xb7634000)
        <etc>

> PS: I have a suggestion as well - I think its best to avoid using C++
> keywords such as "new" and "template" inside the C code for gretl as
> this also causes trouble to folks that are trying to use the shared lib
> from C++.

Fair point; I'll make that change.

Allin Cottrell


More information about the Gretl-users mailing list