On 26 March 2013 20:32, <
anan...@gmail.com> wrote:
> On Tuesday, December 18, 2012 1:49:52 AM UTC+10,
manne...@gmail.com wrote:
> > Hey guys,
> >
> > is it possible to include native C functions at runtime in my Javascript
> like it works at Node.js?
> >
> > For example: var express = require('express');
>
If you can live with an older version of SpiderMonkey, you can use GPSEE
for this pretty easily. It's GPSEE's primary design goal.
> >
> >
> >
> > And if it's possible can you give an example?
>
There are many ways, depending on need. The simplest case, which addresses
90% of needs IME, is to use the gffi module.
#! /usr/bin/gsr
var GFFI = require("gffi");
var puts = new GFFI.CFunction(GFFI.int, "puts", GFFI.pointer);
puts("Hello, World");
Wes
--
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102