octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Functions from Matlab C shared library utility


From: Reza Housseini
Subject: Re: Functions from Matlab C shared library utility
Date: Mon, 12 Aug 2013 10:07:52 +0200




On Mon, Aug 5, 2013 at 3:54 PM, Reza Housseini <address@hidden> wrote:



On Wed, Jul 31, 2013 at 4:27 PM, John W. Eaton <address@hidden> wrote:
On 07/31/2013 08:34 AM, Alexander Barth wrote:

For what it is worth I have attached the file testproto.m.
You might be interest in the library libffi
(http://sourceware.org/libffi/) which is also used by python.

Yes, we should definitely be using libffi and not attempting to reinvent it.


Parsing the header file might not be trivial. As an intermediate step,
having to hand-code the proto file would already be very useful.

Are there any existing free software tools that can do this job, perhaps in a python or perl module?

jwe

Hey everyone thanks for the replys.
I checked with julia and they have a  function called ccall [1] which calls c code but uses llvm in the back (but I couldn't figure out how).

@Alex Thanks for the tests in Matlab, that clarifies things up. As I understand correctly there is now need to figure out header paths for a function call like 

  loadlibrary('/usr/lib/libnetcdf.so')

there is always a user provided path to the header. Is this generated thunk library some kind of converter between Matlab and C for the specified library?

For parsing the header file, I thought of using doxygen to generate xml files and read them in with pugixml [2]. Althought I'm concerned about speed so probably using eventually the parser and lexer from clang is a better option. I also found a script (which is included in the Ubuntu distribution) written in python which parses c headers but I can't find it at the moment anymore.

I also think the libfii library seems an appropriate choice to do this.
I'm using the libltdl [3] library from the libtool library to load, call and unload a library. It is portable to Windows and Unix Systems.

Regarding the header parsing I'm glad for every input, suggestion and comment.

Cheers
Reza


[3] http://www.gnu.org/software/libtool/manual/libtool.html#Using-libltdl

Can someone check in Matlab if it is possible to define multiple key-value pairs of the keys "addheader", "alias", "includepath", "mfilename" and "thunkfilename".
Thanks a lot!

Cheers Reza 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]