purescript-native
purescript-native copied to clipboard
creating shared objects with purescript-native-cpp
I propose to use extern "C" functions for all exposed functions.This makes it possible to use them in shared libraries and shared object files. This solves two issues which could not be addressed with the current c++ functions:
- get rid of the dictionary lookup for ffi calls if you try to use an ffi function which is not implemented yet you will get an error at library or shared object load time, not at runtime of the missing function
- allow for using plugins in an running application this is not quite a repl but it allows live coding in a runnig application. You can edit the plugin module, recompile and reload it in the runnig application as shared object. #27
A runnig example can be found here: hello world which is implemented by changed the pscpp pscpp and ported the ffi functions for the standard library to the C function interface ffi I just used Linux, so no effort was made to make it work on other platforms. I apreciate your comments and wish you a mery christmas.
Using zephirs dead code elimination I was able to link in only the modules and ffi's which are truely needed. This allowes for a gradual completion of the ffi's for the shared library and having the gurantee that the neede ffi's which are used by the executable are actually all in there. https://github.com/freylax/purescript-native-build