Add the ability to call native code

Bug #488588 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Fix Committed
Wishlist
Matt Giuca

Bug Description

Mars currently provides no way to call native code, code written in other languages, or operating system services. Currently, the only non-computational (I/O) facilities in Mars are offered by the built-ins get_char, put_char and get_env.

There should be a way to interface with native code, even if it is very primitive. Provide additional built-in functions which present an interface to the POSIX dlopen/dlsym API. This would allow library modules written in C or other low-level languages to be loaded and functions called.

Also provide built-in types and functions for marshalling data between Mars and native types (C ints and pointers). This can be done in a (dodgy) very simple way by providing a new built-in type, CInt, which represents all C int, object pointer and function pointer types. If malloc and pointer-dereferencing primitives are provided as Mars built-ins, then it should be possible to write routines for marshalling most data structures to and from C.

Tags: feature

Related branches

Revision history for this message
Matt Giuca (mgiuca) wrote :

This is in progress on the public branch, lp:~mgiuca/mars/dlopen. Everything described above has been implemented.

Revision history for this message
Matt Giuca (mgiuca) wrote :

That branch has been renamed to lp:~mgiuca/mars/native.

Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r1348.

Changed in mars:
status: In Progress → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
milestone: none → 1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.