Include native C++ function at runtime in Javascript?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Include native C++ function at runtime in Javascript?

mannermanni
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');

And if it's possible can you give an example?

greez Manner
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

Nicolas B. Pierron
On 12/17/2012 07:49 AM, [hidden email] 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');
>
> And if it's possible can you give an example?

As far as I know, this is not possible, may be the self-hosting modification
made recently made that possible.

Till, do you have any idea about that?

--
Nicolas B. Pierron
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

Wes Garland
In reply to this post by mannermanni
On 17 December 2012 10:49, <[hidden email]> 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');
>
> And if it's possible can you give an example?
>

FWIW, this is exactly the type of problem
http://code.google.com/p/gpseewas created to solve.... provided you
are in a JS embedding environment,
not trying to do this from the browser!

Wes
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

Anthony Catel-4
Typo in the URL : http://code.google.com/p/gpsee

BTW, what's the problem with that? You just have to bind an object to a
JSNative or a container at runtime (either by dynamically loading a
library or already loaded binary).

gpsee abstract this to make it easier.

Le 2012-12-17 18:46, Wes Garland a écrit :

> On 17 December 2012 10:49, <[hidden email]> 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');
>>
>> And if it's possible can you give an example?
>>
>
> FWIW, this is exactly the type of problem
> http://code.google.com/p/gpseewas created to solve.... provided you
> are in a JS embedding environment,
> not trying to do this from the browser!
>
> Wes
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

mannermanni
In reply to this post by mannermanni
Am Montag, 17. Dezember 2012 16:49:52 UTC+1 schrieb [hidden email]:

> 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');
>
>
>
> And if it's possible can you give an example?
>
>
>
> greez Manner

thanks guys i think this will be very helpfull! :)
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

Anand Rathi
In reply to this post by mannermanni
On Tuesday, December 18, 2012 1:49:52 AM UTC+10, [hidden email] 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');
>
>
>
> And if it's possible can you give an example?
>
>
>
> greez Manner

DO you want to look at this ?
http://code.google.com/p/libjspp/
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

Wes Garland
On 26 March 2013 20:32, <[hidden email]> wrote:

> On Tuesday, December 18, 2012 1:49:52 AM UTC+10, [hidden email] 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
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

Anand Rathi
In reply to this post by Anand Rathi
Hi Wes ,
Would you like to try this , its c++ template base interface for JS , Additionaly it avoids multiple mallocs when strings are exchanged between C/C++ & JS
http://code.google.com/p/libjspp/ 

Thanks
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Include native C++ function at runtime in Javascript?

Anand Rathi
In reply to this post by Anand Rathi
Hi Wes,
I recently saw your replies ,
I was wondering if You want to try

http://code.google.com/p/libjspp/

In your products .
I will be very happy & grateful if you could do that

Thanks
Anand
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine