Write GLUEscript modules in FreePascal or access functions in dll/so ?

58 views
Skip to first unread message

PaulANormanNZ

unread,
Sep 27, 2011, 6:20:59 AM9/27/11
to glues...@googlegroups.com
HI,

Is it possible to write appropriate modules for GLUEscript in another envornment like FreePascal which can produce dll or so?

Or is it possible please to load functions from other non GLUEscrit dll or so  ?

Paul

Franky Braem

unread,
Sep 27, 2011, 7:11:51 AM9/27/11
to GLUEscript
The next version will contain ctypes (available in SpiderMonkey 1.8.5)
which makes it possible to call foreign functions in other DLL's.
Is it possible to use SpiderMonkey in FreePascal?

Franky

PaulANormanNZ

unread,
Sep 27, 2011, 7:43:47 AM9/27/11
to glues...@googlegroups.com


On Wednesday, 28 September 2011 00:11:51 UTC+13, bronx wrote:
The next version will contain ctypes (available in SpiderMonkey 1.8.5)
which makes it possible to call foreign functions in other DLL's.

That is going to be truly amazing, that will really strengthen GLUEscript!
 
Is it possible to use SpiderMonkey in FreePascal?

Looks like that is happening here: http://delphi.mozdev.org/javascript_bridge/faq.html
There has been information added within the last few days.

There are other JavaScript or EMCA scripts engines available to FreePascal (Lazarus), 
http://besen.sourceforge.net/ and so on, but I am hoping to make things that might support what is already happening, rather than branching off in other directions.

FreePascal can basically embed forms in dll / so or make utilities that can have forms in them and print results to the command line etc as well. Windows/Linux/MacOsx and  more.

Paul
 

Franky

Paul A Norman

unread,
Sep 27, 2011, 11:25:33 PM9/27/11
to glues...@googlegroups.com
On 28 September 2011 00:11, Franky Braem <franky...@gmail.com> wrote:
> The next version will contain ctypes (available in SpiderMonkey 1.8.5)
> which makes it possible to call foreign functions in other DLL's.
> Is it possible to use SpiderMonkey in FreePascal?
>
> Franky

Actually it looks like there is at least a partial implementation of
this already...

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

This links to the .pas file which defines the class objects, I realise
that it is object pascal but does it look at all like what you would
anticipate was helpful to making a .dll that could be used GLUEscript
to directly provide JavaScript objects/functions?

http://fpcjs.googlecode.com/svn/trunk/src/fpcjs.pas

Paul

Paul A Norman

unread,
Sep 30, 2011, 12:27:17 AM9/30/11
to glues...@googlegroups.com
On 27 September 2011 23:20, PaulANormanNZ <paul.a...@gmail.com> wrote:
> HI,
> Is it possible to write appropriate modules for GLUEscript
> in another envornment like FreePascal which can produce dll or so?

Hi,

With the "gluified" libraries like gd etc.. when glue uses "require" as in
var gd = require("gd");
What is it expecting to find exported from say bin/modules/glue_gd.dll

FreePascal can create most data structures that C or C++ can.

Or is this too complex to be spending time trying to explore perhaps?

Paul

Franky Braem

unread,
Sep 30, 2011, 3:50:42 PM9/30/11
to glues...@googlegroups.com
Op 30/09/2011 6:27, Paul A Norman schreef:

> On 27 September 2011 23:20, PaulANormanNZ<paul.a...@gmail.com> wrote:
>> HI,
>> Is it possible to write appropriate modules for GLUEscript
>> in another envornment like FreePascal which can produce dll or so?
> Hi,
>
> With the "gluified" libraries like gd etc.. when glue uses "require" as in
> var gd = require("gd");
> What is it expecting to find exported from say bin/modules/glue_gd.dll

The interface Poco::Script::JavaScript::SpiderMonkey::ExtensionInterface
must be implemented by all glues.
These are the virtual methods:

virtual Object initialize(Object& obj) = 0;
virtual std::string id() const = 0;

id() returns the name of the glue. For example: gd will be returned by
glue_gd.dll
initialize is used to initialize all JavaScript classes. The object that
is passed is the module object which is returned by the "require" method.

GLUEscript uses the dynamic class loader from the POCO framework.

Paul A Norman

unread,
Oct 1, 2011, 8:24:52 AM10/1/11
to glues...@googlegroups.com
Thanks Franky,

I'll explore that when I can and see if anything is realistiacally
workable from FreePascal.

Paul

> --
> You received this message because you are subscribed to the Google Groups
> "GLUEscript" group.
> To post to this group, send email to glues...@googlegroups.com.
> To unsubscribe from this group, send email to
> gluescript+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/gluescript?hl=en.
>
>

PaulANormanNZ

unread,
Oct 5, 2011, 6:46:16 PM10/5/11
to GLUEscript
I have had a preliminary look at .h header conversions to .pas, but I
am not sure how successful this could be over all yet.

However I am thinking that the ability for GLUEscript to load from
outside .dll, coming in version 0.2 may be all that is realistically
needed?

Paul

On Oct 2, 1:24 am, Paul A Norman <paul.a.nor...@gmail.com> wrote:
> Thanks Franky,
>
> I'll explore that when I can and see if anything is realistiacally
> workable from FreePascal.
>
> Paul
>
> On 1 October 2011 08:50, Franky Braem <franky.br...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Op 30/09/2011 6:27, Paul A Norman schreef:
>
Reply all
Reply to author
Forward
0 new messages