Using static library in Matlab

9 visualizaciones (últimos 30 días)
Leon
Leon el 24 de Jun. de 2014
Respondida: Leon el 24 de Jun. de 2014
I have a 64 bit Linux static library propa64.a, and a corresponding propa.h file with several calls to windows.h, math.h, etc, and description for the functions of the library. I'm trying to use those functions in matlab (2012b) in Linux, by loading the library:
loadlibrary('propa', '/work/propa/propa.h'),
but i'm getting the error:
Failed to preprocess the input file.
Output from preprocessor
is:/top/students/GRAD/ECE/ltolstoy/home/work/propa/propa.h:1:21: error: windows.h: No
such file or directory
Looks like matlab can't find the called from propa.h other header files, which i know are in
/usr/local/matlab-res.2012b/sys/lcc/include folder, and this path is also in the 'path' variable ( i just added it with the path(path,'/usr/local/matlab-res.2012b/sys/lcc/include/') command.
Please suggest me how to make loadlibrary work with propa64.a, or this is not correct way to use static libraries in matlab?

Respuestas (2)

Philip Borghesani
Philip Borghesani el 24 de Jun. de 2014
Static libraries must be turned into dynamic (shared) libraries before they can be used by an existing program. The simplest way to do this for MATLAB is to create a mex file that calls the desired functions in the library.
I think you have other problems though, I doubt that any Linux compatible library requires windows.h on Linux and I have never seen LCC used on with MATLAB on Linux.

Leon
Leon el 24 de Jun. de 2014
Thanks for the answer, Philip. Well, i got this library from logiciels.cnes.fr/PROPA/en/logiciel.htm, the download page has dll file for Windows and only static "propa64.a" for Linux, and only one header file "propa.h" with directives
#include <windows.h>
#include <math.h>
#include <stdio.h>
etc - i suppose it is for both OS. Also my Linux Matlab version has all those header files in matlab-res.2012b/sys/lcc/include , so i believe it is somehow related. I have never made mex files before, are there any tricks to compile static library to dynamic in Matlab? In case header file that i have is not compatible with Linux Matlab somehow, is it still possible to create mex file without propa.h ?

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by