Simplify static/dynamic libraries on Win32 platform

35 views
Skip to first unread message

Neil Hodgson

unread,
Mar 29, 2018, 5:37:45 AM3/29/18
to Scintilla mailing list
On Win32, some files are compiled multiple times with different command-line options to produce various object files. The main option SCI_LEXER chooses whether to include lexing functionality in ScintillaBase.cxx and ScintillaWin.cxx, producing ScintillaBaseL and ScintillaWinL object files. Another option, STATIC_BUILD is used to exclude the main DLLMain entry point and the exported Scintilla_DirectFunction function from ScintillaWin.cxx.

This arrangement makes it more difficult to understand how Scintilla is built and complicates life for those that want to use alternate build tools or integrate Scintilla into applications and libraries.

While SCI_LEXER is difficult to remove, STATIC_BUILD can be removed by adding a new file ScintillaDLL.cxx which contains DllMain and Scintilla_DirectFunction.

Thus, you can build a DLL by including ScintillaDLL and a static library by excluding it. There will be no need to define STATIC_BUILD.

A patch that implements this change is attached.

Neil
NoStatic.patch

Neil Hodgson

unread,
Apr 4, 2018, 2:55:23 AM4/4/18
to Scintilla mailing list
These changes have been committed as
https://sourceforge.net/p/scintilla/code/ci/cfe90078d68471dda5b5dc9282d44f65a2ddc191/

If using the standard build targets on Win32 then you should not need to make any changes. If you are maintaining your own make or project files then change them in the following ways:

Don’t define STATIC_BUILD for Scintilla as it has no effect. Therefore there is no need for separate object files (depending on STATIC_BUILD) from ScintillaWin.cxx.

Link in ScintillaDLL.cxx if making a separate Scintilla-only DLL, else omit it.

Neil

Reply all
Reply to author
Forward
0 new messages