Re: [Iup-users] scintilla LOADLEXERLIBRARY

2021-08-07 Thread Andrew Robinson
Try using DisableThreadLibraryCalls() in the DLLmain function of your DLL to
disable thread attach/detach notifications that aren't present for normally
loaded DLLs.

On 2021-08-06 at 7:32 PM, breadstick  wrote:
>The Lua script stays open because I do the message loop with iup.MainLoop().
The scintilla object is still there.
>
>The dll is loaded when I set loadlexerlibrary="some.dll". I know because the
code in the dll reaches DLL_PROCESS_ATTACH in DllMain().
>What happens is that it gets immediately unloaded (so it reaches
DLL_PROCESS_DETACH).
>
>Some example code:
>
>edit.loadlexerlibrary = "lexluthor.dll"
>print("hi")
>edit.lexerlanguage = "luthor"
>print(edit.lexerlanguage)
>...
>iup.MainLoop()
>
>Here, Lua loads the dll, then unloads it, then prints "hi", then prints
"nil", and then does the main loop.
>I don't know what triggers the unload, because I'm using the very same dll in
the test C program and the lexer works.
>
>Thanks
>
>
>
>On Fri, 6 Aug 2021 13:59:20 -0300
>Antonio Scuri  wrote:
>
>>   When setting that IUP attribute what we do is exactly the same thing.
>> 
>>   It unloads after the script is ended? I mean It actually worked inside
>> the script then is unloaded somehow after that?
>> 
>>   Is the Scintilla object destroyed when the script ends?
>> 
>> Best,
>> Scuri
>> 
>> 
>
>
>___
>Iup-users mailing list
>Iup-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/iup-users



___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] scintilla LOADLEXERLIBRARY

2021-08-06 Thread breadstick
The Lua script stays open because I do the message loop with iup.MainLoop(). 
The scintilla object is still there.

The dll is loaded when I set loadlexerlibrary="some.dll". I know because the 
code in the dll reaches DLL_PROCESS_ATTACH in DllMain().
What happens is that it gets immediately unloaded (so it reaches 
DLL_PROCESS_DETACH).

Some example code:

edit.loadlexerlibrary = "lexluthor.dll"
print("hi")
edit.lexerlanguage = "luthor"
print(edit.lexerlanguage)
...
iup.MainLoop()

Here, Lua loads the dll, then unloads it, then prints "hi", then prints "nil", 
and then does the main loop.
I don't know what triggers the unload, because I'm using the very same dll in 
the test C program and the lexer works.

Thanks



On Fri, 6 Aug 2021 13:59:20 -0300
Antonio Scuri  wrote:

>   When setting that IUP attribute what we do is exactly the same thing.
> 
>   It unloads after the script is ended? I mean It actually worked inside
> the script then is unloaded somehow after that?
> 
>   Is the Scintilla object destroyed when the script ends?
> 
> Best,
> Scuri
> 
> 


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] scintilla LOADLEXERLIBRARY

2021-08-06 Thread Antonio Scuri
  When setting that IUP attribute what we do is exactly the same thing.

  It unloads after the script is ended? I mean It actually worked inside
the script then is unloaded somehow after that?

  Is the Scintilla object destroyed when the script ends?

Best,
Scuri


Em sex., 6 de ago. de 2021 às 13:21, breadstick 
escreveu:

> Hi
> I'm using Iup 3.3.0, Lua 5.3.5, iup-scintilla 3.11.2.
> I'm trying to load an external lexer library for scintilla.
>
> What I do is simply:
> --creation
> edit = iup.scintilla{ ... }
> --load lexer
> edit.loadlexerlibrary = "lexluthor.dll"
>
> The dll loads correctly, but then it unloads immediately. The Lua/Iup
> script continues to work, it's just the lexer dll that gets unloaded for
> some reason.
>
> The lexer dll I'm using is basically like the template you can find here:
> www.scintilla.org/LexPython.cxx.html, but without the calls to the python
> lexer, so it's an empty lexer that doesn't do anything; it's just for
> testing.
> The lexer dll is built with the headers/sources of scintilla 3.11.2, the
> same version used by Iup, and using the same g++ swithes that are in the
> makefile scintilla-3.11.2\win32\makefile.
>
> Just to be sure, I've made a small C program that loads the scintilla dll
> (again, version 3.11.2) and then it loads the lexer dll with:
> SendMessage(hsci, SCI_LOADLEXERLIBRARY, (WPARAM)0,
> (LPARAM)"lexluthor.dll");
> This time the dll stays loaded correctly, and I can set the lexer with
> SCI_SETLEXERLANGUAGE.
>
> So it appears to be a problem in Iup.
>
> Any suggestions on why Iup unloads the dll?
>
> Thanks
>
>
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] scintilla LOADLEXERLIBRARY

2021-08-06 Thread breadstick
Hi
I'm using Iup 3.3.0, Lua 5.3.5, iup-scintilla 3.11.2.
I'm trying to load an external lexer library for scintilla.

What I do is simply:
--creation
edit = iup.scintilla{ ... }
--load lexer
edit.loadlexerlibrary = "lexluthor.dll"

The dll loads correctly, but then it unloads immediately. The Lua/Iup script 
continues to work, it's just the lexer dll that gets unloaded for some reason.

The lexer dll I'm using is basically like the template you can find here: 
www.scintilla.org/LexPython.cxx.html, but without the calls to the python 
lexer, so it's an empty lexer that doesn't do anything; it's just for testing.
The lexer dll is built with the headers/sources of scintilla 3.11.2, the same 
version used by Iup, and using the same g++ swithes that are in the makefile 
scintilla-3.11.2\win32\makefile.

Just to be sure, I've made a small C program that loads the scintilla dll 
(again, version 3.11.2) and then it loads the lexer dll with:
SendMessage(hsci, SCI_LOADLEXERLIBRARY, (WPARAM)0, (LPARAM)"lexluthor.dll");
This time the dll stays loaded correctly, and I can set the lexer with 
SCI_SETLEXERLANGUAGE.

So it appears to be a problem in Iup.

Any suggestions on why Iup unloads the dll?

Thanks


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users