Date: 02-16-2022
Return to Index
created by gbSnippets
'This snippet shows how to create a DLL that can be called from
'SciLexer.DLL as an external lexer.
'The scilexer.dll runs a lexer called "ExternalLexer", which in turn
'makes the calls to the DLL created by the code below.
'ExternalLexer takes the following steps/makes the following calls:
'???
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile DLL "CustomPowerBASICLexer" 'use filename "CustomPowerBASICLexer.dll"
#Dim All
%Unicode=1
#Debug Error On 'catch array/pointer errors - OFF in production
#Debug Display On 'display untrapped errors - OFF in production
Function PBLibMain() As Long
Static flag As Long
If Flag = 0 Then
MsgBox "I'm in!"
Flag = 1
Else
If Err Then MsgBox "Error, too!" + Error$(Err)
MsgBox "I'm leaving!"
End If
End Function
' Exported Functions ----------------------------------------
Function GetLexerCount Alias "GetLexerCount" () Export As Long 'Int EXT_LEXER_DECL GetLexerCount();
Function = 1
End Function
Sub GetLexerName Alias "GetLexerName" ( _ 'void EXT_LEXER_DECL GetLexerName(
ByVal Index As DWord, _ 'unsigned Int Index,
ByVal langName as AsciiZ PTR, _ 'char *Name, : alternate: Name As AsciiZ
ByVal bufLength As Long _ 'int buflength
) Export
@langName = "custompowerbasic"
End Sub
Sub Lex Alias "Lex" ( _ 'void EXT_LEXER_DECL Lex(
ByVal lexer As DWord, _ 'unsigned Int lexer,
ByVal startPos As DWord, _ 'unsigned Int startPos,
ByVal LengthDoc As Long, _ 'int length,
Byval initStyle as Long, _ 'int initStyle,
ByVal Words As AsciiZ Ptr, _ 'char *words[], : pointer to first element of string array
ByVal wID As DWord, _ 'WindowID Window, : alternate: wID As Any
ByVal Props As AsciiZ Ptr _ 'char *props : alternate: props As AsciiZ : pointer to ASCIIZ string
) Export
End Sub
Sub Fold Alias "Fold" ( _ 'void EXT_LEXER_DECL Fold(
ByVal lexer As DWord, _ 'unsigned Int lexer,
ByVal startPos As DWord, _ 'unsigned int startPos,
ByVal LengthDoc As Long, _ 'int length,
ByVal initStyle As Long, _ 'int initStyle,
ByVal Words As AsciiZ Ptr, _ 'char *words[], : pointer to first element of string array
ByVal wID As DWord, _ 'WindowID Window, : alternate: wID As Any
ByVal Props As AsciiZ Ptr _ ' char *props : alternate: props As AsxiiZ : pointer to ASCIIZ string
) Export
End Sub
' Private Functions ----------------------------------------
' to be defined once I understand what I/O are involved with
' calls from scilexer.dll
'gbs_00666
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm