Subj : Executing a line of C code in javascript To : netscape.public.mozilla.jseng From : Heath Raftery Date : Fri Aug 22 2003 01:16 am This is a modified repost from comp.lang.javascript. Sorry if you've seen it before - at least one person hasn't ;) Okay, I've been working with SpiderMonkey to execute some javascript in my C application. Now, I need to execute a line of C code within my javascript! I've gone round and round trying to find a solution - I need to be able to parse PAC (proxy automatic configuration) scripts in my application. I turned to SpiderMonkey, eventually found the pacUtils in the mozilla netwerk tree, and got 90% there. Unfortunately, a few of the functions in pacUtils require a dns lookup, which is not supported in plain javascript. Mozilla appears to handle it by linking to a c++ class called nsDNSService. I noticed that previously in comp.lang.javascript, people have claimed that C++/C functions are tricky to execute in javascript, possibly requiring ActiveX interfaces or JNI work. However, Mozilla seems to do it fine. 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! Regards -- Heath ________________________________________________________ | *Nothing is foolproof to a sufficiently talented fool* | | _\|/_ | |________________________________________m(. .)m_________| .