← Previous Change
side by side
lines around each change
Show the changes in full context
White space changes
03/21/12 21:21:31 (
= Exporting Symbols =
Some ports limit the exported symbols. We need to mark API symbols as exported when we use it outside the library.
There is two primary way to export symbols: '''export lists''' and '''inline annotations'''. Some ports use export lists. others use inline annotations, or even both.
== Export Lists ==
An export list is a text file which contains the list of exporting symbols.
Linkers refer these files to decide which symbols should be exported.
Ports have their own separate lists:
* Mac port uses this to build WebCore.framework.
* GTK port uses this to build libwebkitgtk.so
* Mac WebKi2 port uses this to build WebKit2.framework
* Apple Win port uses this to build WebKit2.dll
* CFLite Win port uses this to build WebKit2.dll
== Inline Annotations ==
Inline annotations is compiler-specific qualifiers which are encapsulated by a set of macros.
These macros are defined in following files:
* JS_EXPORT_PRIVATE, JS_EXPORTDATA
* (TODO: List port specific definitions for WebKit API layer here.)
Inline annotations are adopted as following:
* Mac port uses WTF_EXPORT, WTF_EXPORT_PRIVATE, JS_EXPORT, JS_EXPORT_PRIVATE, JS_EXPORTDATA to export WTF and JSC symbols.
* Win ports use it JS_EXPORTDATA for exporting JSC static variables.
* Many port have use their own inline annotations to export their WebKit API.
=== Caveat ===
* You cannot export inline function.
* If you need to export C++ vtables (that rarely happens though), you need to add JS_EXPORT_PRIVATE or WTF_EXPORT_PRIVATE to the class definition.
== How can I export my symbols? ==
Here are some typical scenarios when you need to care about symbol export:
=== Exporting WebCore symbols to use them from port WebKit implementations ===
* If you use it from Mac(WK1), you need to edit WebCore.exp.in.
* Otherwise you don't need to do anything about symbols.
* You need to add JS_EXPORT_PRIVATE or WTF_EXPORT_PRIVATE to the function.
=== Exporting WebCore symbols to use them from Internals object (WebCoreTestSupport) ===
* You also need to add JS_EXPORT_PRIVATE or WTF_EXPORT_PRIVATE to exporting functions.
For WebCore symbols, you need to edit following files...
* WebCore.exp.in, symbols.filter, WebKit2.order, WebKit2.def, WebKit2CFLite.def
* You shouldn't do it.
* If you inevitably need to do it, it's same as the Internals appraoch noted above.
=== Exporting WebKit API symbols to applications ===
TODO: Write port specific way to do this.