<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px 0px 0px 122.4px; text-indent: -122.5px; line-height: normal; font-family: Courier; color: rgb(76, 76, 76);" class="">I was wondering if I could get some feeback on an ECL feature request that I posted here: <a href="https://gitlab.com/embeddable-common-lisp/ecl/issues/336" class="">https://gitlab.com/embeddable-common-lisp/ecl/issues/336</a></div><div style="margin: 0px 0px 0px 122.4px; text-indent: -122.5px; line-height: normal; font-family: Courier; color: rgb(76, 76, 76);" class=""><br class=""></div><div style="margin: 0px 0px 0px 122.4px; text-indent: -122.5px; line-height: normal; font-family: Courier; color: rgb(76, 76, 76);" class="">Here is the text:</div><div style="margin: 0px 0px 0px 122.4px; text-indent: -122.5px; line-height: normal; font-family: Courier; color: rgb(76, 76, 76);" class=""><br class=""></div><div style="margin: 0px 0px 0px 122.4px; text-indent: -122.5px; line-height: normal;" class=""><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">I would like to be able to call functions using dynamic FFI in the program into which ECL has been embedded.</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">In Linux, you can do this by calling `dlopen` with `NULL` for the filename.</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">> If filename is NULL, then the returned handle is for the main</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">       program.</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><a href="http://man7.org/linux/man-pages/man3/dlopen.3.html" class="">http://man7.org/linux/man-pages/man3/dlopen.3.html</a></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">Looking at ECL source code, it does not seem to be supported. `dlopen` is called in `c/ffi/libraries.d` like this:</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">      char *filename_string = (char*)filename->base_string.self;</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">    #ifdef HAVE_DLFCN_H</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">      block->cblock.handle = dlopen(filename_string, RTLD_NOW|RTLD_GLOBAL);</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">So, I guess there's no way to set `filename_string = NULL`.</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">One way to do it would be to say if you call</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">    (ffi:load-foreign-library "")</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">Then it will skip the checks to see if the file exists and just call `dlopen(NULL, ...`</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">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.</font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class=""><br class=""></font></div><div style="margin: 0px 0px 0px 122.4px; line-height: normal;" class=""><font color="#4c4c4c" face="Courier" class="">Thank you for your attention.</font></div></div><div style="margin: 0px 0px 0px 122.4px; text-indent: -122.5px; line-height: normal; font-family: Courier; color: rgb(76, 76, 76);" class=""><br class=""></div><div style="margin: 0px 0px 0px 122.4px; text-indent: -122.5px; line-height: normal; font-family: Courier; color: rgb(76, 76, 76);" class=""><br class=""></div></body></html>