Why do I receive errors when I attempt to explicitly load generated shared libraries created from the MATLAB C/C++ Math Libraries on Linux?

7 views (last 30 days)
Why do I receive errors when I attempt to explicitly load generated shared libraries created from the MATLAB C/C++ Math Libraries on Linux?
I have created a shared library using the MATLAB Compiler on Linux using MATLAB (for example, libhello.so). When I attempt to load this from standalone C-code using the DLOPEN function, I receive an error.
I use the following steps to compile the program:
1. I execute the following code:
mcc -t -W lib:libhello -T link:lib hello.m
gcc -o test main.c -ldl
2. I then receive the following error when executing the 'test':
$ ./test
libmwlapack: load error:
/usr/local/src/matlab-6.1/bin/glnx86/atlas_PIII.so:
undefined symbol: ieeeck_
libmwlapack: load error: /usr/local/src/matlab-6.1/bin/glnx86/lapack.so:
undefined symbol: xerbla_

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
You are receiving this error because the loader on Linux is currently unable to resolve symbols that are required by an explicitly loaded dynamic link library.
As a work around, please call the functions in the shared library implicitly, as the following pseudocode indicates (do not use dlopen(..) to load the library at run time):
#include "hello.h"
void main()
{
mlfInitializeHello();
//Make call to mlfHello(..)
mlfTerminateHello();
}
This way, you are directly linking against libhello.so.

More Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!