On Wed, Nov 20, 2013 at 10:16 AM, Andres Valloud <avalloud@smalltalk.comcastbiz.net> wrote:
On 11/20/13 8:51 , Eliot Miranda wrote:
No matter what, the following defines a function that takes an integer
and returns the result of malloc:

#include <stdlib.h>
void *malloc_wrapper(int n) { return malloc(n); }

This wrapper can be auto-generated and compiled into a shared object or
dll and used to wrap whatever crap the underlying platform chooses to
use in implementing malloc.

This is the same that I said before: just write a few lines of C, and use a C compiler to make prims or VM plugins (in the shape of a .dll or .so file).

But you apparently miss the point that it can also be used to help a general FFI functon, and that FFI is much more useful than plugins, as discussed in this and related threads.
 
    Generally, I agree that one could carefully and consciously write
    comparatively small primitives and/or plugins.  Then, one could
    compile those with a C compiler in a compilation environment
    compatible with that of the VM.  And then, one could call those
    primitives and/or plugins from the image with the expectation
    (within reason) that they should work.

Andres.

-- 
Eliot