Lexilla.dll does not work with win32

13 views
Skip to first unread message

Carsten

unread,
Jun 23, 2021, 5:27:57 PMJun 23
to scite-interest
I have compiled scite without STATIC_BUILD to use lexilla.dll with win32. The compilation works fine but I doesn't have syntax highlighting.

The problem are the exported function names from lexilla.dll. With win64 GetProcAddress find a valid address. With win32 it doesn't.

With win64 one exported function name is GetLexerCount, with win32 it is _GetLexerCount@0.

I have changed the defines in lexilla.h to 

#define LEXILLA_GETLEXERCOUNT "_GetLexerCount@0"
#define LEXILLA_GETLEXERNAME "_GetLexerName@12"
#define LEXILLA_GETLEXERFACTORY "_GetLexerFactory@4"
#define LEXILLA_CREATELEXER "_CreateLexer@4"
#define LEXILLA_LEXERNAMEFROMID "_LexerNameFromID@4"
#define LEXILLA_GETLIBRARYPROPERTYNAMES "_GetLibraryPropertyNames@0"
#define LEXILLA_SETLIBRARYPROPERTY "_SetLibraryProperty@8"
#define LEXILLA_GETNAMESPACE "_GetNameSpace@0"

Then it works with win32 too. I think this is an error.

Carsten

Neil Hodgson

unread,
Jun 23, 2021, 5:55:28 PMJun 23
to scite-i...@googlegroups.com
Carsten:

> I have compiled scite without STATIC_BUILD to use lexilla.dll with win32. The compilation works fine but I doesn't have syntax highlighting.
>
> The problem are the exported function names from lexilla.dll. With win64 GetProcAddress find a valid address. With win32 it doesn't.
>
> With win64 one exported function name is GetLexerCount, with win32 it is _GetLexerCount@0.

For gcc, that should have been fixed with
https://github.com/ScintillaOrg/lexilla/commit/9e60005b9044f2f09724c289f80a4458898bc928#diff-bc80c8ec09d04e5b45a0c916a16106d1201d7e4442e65f6b14482487ae00e00b

If you are using MSYS2 then switch to MinGW-64 from a CMD prompt.

It shouldn’t occur with Visual C++ as it uses Lexilla.def to set the names.

Neil

Carsten

unread,
Jun 24, 2021, 1:26:25 PMJun 24
to scite-interest
I built Scite with Visual C++ in MSVC 2019.

In lexilla.mak there is a linker option -DEF:Lexilla.def which is missing in Lexilla.vcxproj.

I added the link option 

     <ModuleDefinitionFile>lexilla.def</ModuleDefinitionFile>

to Lexilla.vcxproj then it works.


I wonder why generation for win64 work although the link option is missing too.


There is another problem: The entry LexerNameFromID in lexilla.def is missed.

EXPORTS
GetLexerCount
GetLexerName
GetLexerFactory
CreateLexer
GetLibraryPropertyNames
SetLibraryProperty
LexerNameFromID   <---
GetNameSpace


Carsten

Neil Hodgson

unread,
Jun 24, 2021, 6:32:46 PMJun 24
to scite-i...@googlegroups.com
Carsten:

In lexilla.mak there is a linker option -DEF:Lexilla.def which is missing in Lexilla.vcxproj.

I added the link option 

     <ModuleDefinitionFile>lexilla.def</ModuleDefinitionFile>

to Lexilla.vcxproj then it works.


I wonder why generation for win64 work although the link option is missing too.

   On 64-bit Windows a single calling convention is used for both cdecl and stdcall so there is no need to decorate the stdcall name. On 32-bit Windows, these calling conventions are different.

There is another problem: The entry LexerNameFromID in lexilla.def is missed.

Reply all
Reply to author
Forward
0 new messages