octave-maintainers
[Top][All Lists]
Advanced

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

Re: Implementing loadlibrary, calllib, etc.


From: Michael Goffioul
Subject: Re: Implementing loadlibrary, calllib, etc.
Date: Wed, 24 Mar 2010 07:40:22 +0000

On Wed, Mar 24, 2010 at 2:46 AM, John Swensen <address@hidden> wrote:
> I recently had a colleague who used the Matlab loadlibrary, calllib, etc. 
> functions for accessing stepper motor controller (rather than writing a MEX 
> function).  I started looking to see if this was available in Octave, as it 
> seems quite useful, and found that it is not implemented.  I then started 
> searching for a way of building dynamic function argument lists in C/C++, so 
> one could dlopen a shared library, parse a header file for function names 
> with corresponding return type and parameters, and then calling into the 
> shared library from Octave.

Good stuff. I have done the same a few years ago for ECL (Lisp Implementation),
however I didn't actually use FFCALL, because of license mismatch. However
in this case, I guess using FFCALL is the right way to go.

> So now it seems that I should be able to do this sort of thing, but lack one 
> critical skill: regular expressions.  I think I could come up with a very 
> inelegant way of parsing a header file to extract function names, return 
> types, and parameters types, but would be open to some help from one of those 
> regular expression wizards out there in this part of the process.  Once that 
> is complete, I think I can implement the loadlibrary, callib, etc. quite 
> accurately.  (I suppose I could also take the time to learn regular 
> expressions well, but that might take more time than I have right now).

Just wondering if you couldn't use a lex/yacc based parser instead.
I'm pretty sure you can easily find existing C/C++ syntax files out there, such
that you'd only have to implement the right hooks, and not worry about
the C/C++ syntax.

Michael.



reply via email to

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