[Ecls-list] Tighter c/c++ integration, toplevel inline c/c++ code ???

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Mon May 3 13:23:50 UTC 2010


On Mon, May 3, 2010 at 3:03 PM, Seth Burleigh <seth at tewebs.com> wrote:

> ffi:clines introduces all code into the header file and does not inline
> code into the c file. Can you declare c++ class methods in header files
> and in general arbitrary c/c++ code?


Header files in C/C++ are nothing special at all. The C/C++ preprocessor
will at some point find the #include statement and read in all of the
header. That's all.. The reason why the code is placed there is because it
has to appear before _any_ common lisp code.


> Can  you call obfuscated lisp
> functions in the header file and are functions/classes defined in the
> header file automatically exported (which isn't desirable)? (i dont
> know, i dont usually do this)
>

Forget about "headers" or not "headers". Just think about C/C++ code. Such
code can or can not export things and that does not depend on where you
place it, but rather how you write it. Types are NEVER exported. Functions
may be and in particular the previous example should have read

static int foo(int a, int b) { ....

so that the function does not get exported.


> But besides that, i tested your code and was wondering how i access the
> c code from the REPL.


This is not possible because we are no C/C++ interpreter. You need to
compile and load the compiled files first.

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100503/e32160fd/attachment.html>


More information about the ecl-devel mailing list