embedding ecl without (build-program)

Daniel Kochmański daniel at turtleware.eu
Mon Feb 29 12:28:09 UTC 2016


Hello,

Juraj Variny writes:

> Hello,
>
> Is there is a way for ECL only to generate a bunch of .cpp files that can be 
> fed to existing build system? I'm halfway there by generating C from my  
> (ffi:c-inline) stuff like:
>
> (compile-file "src/common/lisp/lispinterface.lisp" :output-file 
> "src/common/lisp/lispinterface.cpp").

generally that's how it's done (generating the C files).
>
> But how do I initialize it on app startup? Looks like 
>
> void init_fas_CODE(cl_object flag) 
>
> should be called, but with what parameters?

I'm afraid that it won't work the way you want it to run. Standalone
executables (and the shared libraries), still require libecl to run
(linked either dynamically or statically, note however that static
linkage results in covering code you link with with LGPLv2).
>
> Some background: I am trying to embed ECL in a big C++ app with its own 
> byzantine build system (ftjam with own layer on top of it). These C++ 
> functions I am interfacing are not exposed externally (and I prefer not to), 
> thus trying to load .fas file at runtime results in linker error. Also, I 
> can't use (build-program) which won't work together with the build system.
>
> However, if (build-program) knows how to neatly pack whole initialization into 
> one C function, that would solve the problem, too.

As already said, C code requires ECL runtime (library). Path I would
suggest would be linking ECL dynamically (providing .so file or .dll
depending on platform), and loading the code in built FAS file with the
ECL's si_load_binary.

Note, that if you don't change the platform nor the ECL, you may
precompile FAS and load them at your convenience later.

>
> Regards, 
>
> Juraj

Best regards,
Daniel

-- 
Daniel Kochmański ;; aka jackdaniel | Poznań, Poland
TurtleWare - Daniel Kochmański      | www.turtleware.eu

"Be the change that you wish to see in the world." - Mahatma Gandhi



More information about the ecl-devel mailing list