I would like to be able to call functions using dynamic FFI in the program into which ECL has been embedded.
In Linux, you can do this by calling `dlopen` with `NULL` for the filename.
> If filename is NULL, then the returned handle is for the main
program.
Looking at ECL source code, it does not seem to be supported. `dlopen` is called in `c/ffi/libraries.d` like this:
char *filename_string = (char*)filename->base_string.self;
#ifdef HAVE_DLFCN_H
block->cblock.handle = dlopen(filename_string, RTLD_NOW|RTLD_GLOBAL);
So, I guess there's no way to set `filename_string = NULL`.
One way to do it would be to say if you call
(ffi:load-foreign-library "")
Then it will skip the checks to see if the file exists and just call `dlopen(NULL, ...`
Another way would be to make a new function `ffi:load-main-program`. I don't have any suggestions as to which would be better as I am very new to Lisp.
Thank you for your attention.