[Vm-dev] re: Can OSProcess functionality be implemented using FFI instead of plugin?

Ben Coman btc at openinworld.com
Thu Jan 21 13:56:01 UTC 2016

On Thu, Jan 21, 2016 at 9:07 AM, Mariano Martinez Peck
<marianopeck at gmail.com> wrote:
> On Wed, Jan 20, 2016 at 5:33 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>> On Wed, Jan 20, 2016 at 10:55 AM, Mariano Martinez Peck <marianopeck at gmail.com> wrote:
>>> Hi Eliot,
>>> Ok, I started from the first step and I am able to type a C program that would export the STON I need.
>>> This is all hardcoded for the moment and not autogenerated.
>>> The question I have now is....do you think I should use "cmake" for managing the compilation of this C program (later to be autogenerated) ???
>>> If not, what other choice I have?
>> Cmake is overkill.  You only have to compile one file with very simple flags.  So for now use the old  OSProcess (or compile manually) but... once you have your own OSProcess then the right way is to compile it using your new OSProcess.  You have to require that the user put the C compiler in their path, but everything else you have in the pragmas.  e.g. you're only doing
>> cc -m32 -o MYSQLInterface.mac32 MYSQLInterface.mac32.c
>> ./MYSQLInterface.mac32
> Thanks Eliot,
> I had the same feeling. Thanks for confirming.
> BTW, let me ask...I have already starting coding this so I have to give a name to the project so that I can create a repo and start committing :)
> (even if at the end this is merged in FFI package or whatever)
> Do you have a good name in mind?   I would like FFI in it's name, but not SharedPool (that's a low level impl detail). I don't want to couple with "Constants" either as it may help us with other stuff like sizeof() etc.   I guess it should be something related to FFIPreprocessorInfoExtractor or something like that.

How about:
* FFIDefines
* FFIHeaders
* FFIDefs
* FFIDecl
* FFIDeclarations

or do like other language FFIs and distinguish that this is a "C" interface...
* CDeclaration
* FFICDecl

btw, only slightly off topic... I just read something very interesting
about using the host** finalization and garbage collector to free
guest** malloc'd memory to reduce memory leak.  Scroll down to "Memory
management: let the garbage collector do the work"
(**are these reaonble terms to use here?)
Note: I don't actually know Haskell. I only got distracted and bumped
into this while looking for other info.

Lua seems to have something similar...
      cdata = ffi.gc(cdata, finalizer)

* 4.1 Naming conventions




More information about the Vm-dev mailing list