Exporting Symbols

Some ports limit the exported symbols. We need to mark API symbols as exported when we use it outside the library. Since WebKit consists of a set of libraries (WTF, JavaScriptCore, WebCore, WebKit), each library need to export symbols if the API is used from a different 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:

Inline Annotations

Inline annotations is compiler-specific qualifiers which are encapsulated by a set of macros. These macros are defined in following files:

  • (TODO: List port specific definitions for WebKit API layer here.)

Inline annotations are adopted as following:

  • Win ports use it JS_EXPORTDATA for exporting JSC static variables.
  • Many port have use their own inline annotations to export their WebKit API.


  • 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
  • Otherwise you don't need to do anything about symbols.

Exporting JavaScriptCore/WTF symbols to use them from port WebCore

  • You need to edit JavaScriptCore.def
  • You need to add JS_EXPORT_PRIVATE or WTF_EXPORT_PRIVATE to the function.

Exporting WebCore symbols to use them from Internals object (WebCoreTestSupport)

  • Only WebCore symbols need to be exported which are used in Internals (if not already exported. Check previous definitions first)
  • Internals symbols need not be exported.

For WTF/JavaScriptCore symbols,

  • You need to edit JavaScriptCore.def.
  • You also need to add JS_EXPORT_PRIVATE or WTF_EXPORT_PRIVATE to exporting functions.

For WebCore symbols, you need to edit following files...

  •, symbols.filter, WebKit2.order

Exporting WTF/JavaScriptCore/WebCore symbols to use them from DumpRenderTree

  • 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.

Last modified 9 years ago Last modified on Aug 13, 2013 2:47:49 PM