[webkit-dev] How to use JavaScriptCore in my own project

Darin Adler darin at apple.com
Tue Mar 17 13:58:20 PDT 2009


On Mar 17, 2009, at 1:24 PM, Gustaw Smolarczyk wrote:

> I want to use JavaScriptCore as script engine in my own project in C+ 
> +, but I don't know how to do that right way. There are  
> JavaScriptCore, JavaScriptGlue, etc in WebKit source and I don't  
> know how to use JavaScript engine from WebKit similar way I do it  
> using e.g. QtScript. Any documentation/tutorials? Or am I blind  
> because it's simple? :)


JavaScriptCore has a public API, which is relatively platform- 
independent, unlike WebKit itself, which does not.

The headers for this are JSBase.h, JSContextRef.h, JSObjectRef.h,  
JSStringRef.h, and JSValueRef.h.

How this is exported and made available on each platform is something  
I’m less sure of. Since you mention Qt, you might want to ask the  
folks maintaining the Qt port if they ensure this API is exported with  
headers installed.

I know this is the case on Mac OS X with the native JavaScriptCore  
included as part of the OS.

     -- Darin



More information about the webkit-dev mailing list