Oliver Hunt wrote:
Dependency walker tells me that the JavaScriptCore.dll depends on
CFLite.dll, pthreadvc2.dl, and ICUUC40.dll.  Perhaps these links are
not all needed; now that JavaScriptCore is its own DLL, we should be
able to get rid of pthreadvc2 (IIRC, the only reason it was kept after
the win32 threading work was that a dll target was needed for handling
thread shut-down.)

I'm not sure if CFLite/CoreFoundation is really needed.  Their
inclusion in the header file is no doubt the cause of your compiler
problems, but it might just be that the CoreFoundation link library
was left in when JavaScriptCore was made a separate DLL.

Darin, do you know if CoreFoundation is really needed by
JavaScriptCore? Or maybe Olliver would know?

Beyond the requirements of JSStringRef.h (eg. that a few types exist) there should not be any deliberate dependency on CF in JSC for anything other than platform specific behaviour, and a quick scan indicates that all such sites seem to have appropriate ifdef guards.

On non-CF platforms you also only want to include JavaScriptCore/JavaScript.h not JavaScriptCore/JavaScriptCore.h as it is JavaScriptCore.h that brings in the CF APIs. The only real concern beyond that is to make sure that in builds where you do not want a CF dependency in JSC to ensure that PLATFORM(CF) is false and that JSStringRefCF.cpp is not compiled.

In an ideal world that should Just Work.

--Oliver
Here's what works so far, and a couple suggestions. Note that I am shifting my engine from SpiderMonkey to JSC, so all I'm concerned with right now is the headers compiling, I have a lot of work ahead to remake the glue code before I attempt to run it with an actuall DLL/LIB combo.

You need these headers:

JavaScript.h
JSBase.h
JSContextRef.h
JSObjectRef.h
JSStringRef.h
JSValueRef.h
stdbool.h
WebKitAvailability.h

And put this in your headers:

// get rid of it trying to use STDBOOL
#define STDBOOL_WIN32_H

// if not already defined by some other code
typedef unsigned char            bool;
#define true 1
#define false 0

#include <JavaScriptCore/JavaScript.h>

OK, obviously needing stdbool is a problem here as it's meant for compiling the DLL, not integrating the DLL. Maybe check for windows in JavaScript.h and put the three defines in there? I suspect (could be wrong, didn't check) that JavaScript.h is a header not used in the DLL compile. Then you could remove stdbool from JSBase (where it's referenced.) Obviously, you guy know this code far better than I would :)

Another slight problem is that I already defined bool and I suspect a lot of others will when doing cross platform code, so they are going to have to be sure to use the same bool or they'll get a re-def error.

Another thing that's a little obnoxious is that you have to have all you .h files in a JavaScriptCore directory because of the OS X naming for the headers. This is not a big deal at all, but could potentially throw off some non OS X users. Not something I'd worry about changing, but maybe something noted in a doc somewhere.

This is a really good bit of code for a script engine. The future is javascript embedded in about everything, so the easier it is to compile this alone the better :)

[>] Brian
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to