Skip to content

creating shared objects with purescript-native-cpp #47

@freylax

Description

@freylax

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.
    Discuss: C++-specific REPL support #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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions