Subj : Re: Executing a line of C code in javascript To : netscape.public.mozilla.jseng From : Heath Raftery Date : Mon Aug 25 2003 12:41 am In article , David Bradley wrote: > Heath Raftery wrote: > > So, how would I achieve this without including most of mozilla in my > > application? Is there a simpler way of achieving the same? I just want > > to resolve a host name! Or even simpler - I just want to parse a PAC > > file! > > Do you have control over the code you're embedding SpiderMonkey in? What > you need to do is to use JS_DefineFunction to link the C function to an > object, possibly the global object. js.c has an example of what I'm > talking about http://lxr.mozilla.org/seamonkey/source/js/src/js.c#2218. > That defines multiple functions, JS_DefineFunction can be used to define > a single function. Ah! That looks perfect! Very interesting indeed. Give me a couple of days to find some time to read up and give it a shot, but it looks like that should get me home :) Thanks very much, I'll report on any progress soon. -- Heath ________________________________________________________ | *Nothing is foolproof to a sufficiently talented fool* | | _\|/_ | |________________________________________m(. .)m_________| .