Page 1 of 1
DLL crashes with PB 6.11
Posted: Sun Aug 04, 2024 2:36 pm
by Jens-Arne
Hello,
a DLL that is created and compiled with PureBasic 6.11 crashes when it is loaded into another program (e.g. with OpenLibrary in PureBasic). This problem applies to the 32bit native compiler only (64bit is completely ok, 32bit with C-backend is ok, too). It doesn't matter which version the main program is compiled with, it depends on the version the DLL was built with.
This was not the case with exactly the same code and PureBasic 6.01 (I didn't use and therefore haven't tested the versions inbetween).
Could somebody please look into this problem when there is time available for it?
Thank you very much, Jens-Arne
Re: DLL crashes with PB 6.11
Posted: Sun Aug 04, 2024 3:51 pm
by Quin
Just tested this on Windows 11 24H2 LTSC, and can confirm the behavior with PB 6.11 (32-bit), ASM compiler.
My test DLL was:
Code: Select all
ProcedureDLL Test()
ProcedureReturn 1
EndProcedure
Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 9:29 am
by Fred
I tried but I can't reproduce the issue here (Windows 10), can anyone else confirm with x86-asm compiler ?
DLL code:
Code: Select all
ProcedureDLL Test()
ProcedureReturn 25
EndProcedure
Main code:
Code: Select all
OpenLibrary(0, "test2.dll")
Debug CallFunction(0, "Test")
Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 9:50 am
by Axolotl
Hi,
I tested the code with PB 6.04 LTE (x86) on windows 11 (home).
Debug Output is 25.
So works here as expected.
Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 10:48 am
by Fred
The crash should be with 6.11

Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 10:55 am
by mk-soft
Work here with Windows 10 Pro
PB v6.11, v6.12b2, x86 and x64
Did you also compile the DLL with the x86 version?
Code: Select all
CompilerIf #PB_Compiler_ExecutableFormat = #PB_Compiler_DLL
ProcedureDLL Test()
ProcedureReturn 25
EndProcedure
CompilerElse
Debug "Main"
If OpenLibrary(0, "TestDLL.dll")
r1 = CallFunction(0, "Test")
Debug "DLL Result = " + r1
CloseLibrary(0)
Else
Debug "Error open librariy"
EndIf
CompilerEndIf
Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 11:11 am
by Denis
Work here with Windows 11 Professionnel version 23H2
PB 6.12b2, x86
Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 11:15 am
by Jens-Arne
Now this is really strange. I can't reproduce the error anymore (Windows 11). I did a Win11 update recently. Maybe it was down to some obscure error in Win11.
@Quin: How is the situation with your machine now?
Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 2:34 pm
by Quin
Jens-Arne wrote: Fri Aug 16, 2024 11:15 am
Now this is really strage. I can't reproduce the error anymore (Windows 11). I did a Win11 update recently. Maybe it was down to some obscure error in Win11.
@Quin: How is the situation with your machine now?
I ended up unexpectedly needing to get a new laptop, so I unfortunately don't have the exact machine I used to test. However, it seems to work here on this new laptop, PB 6.11 LTS (x86) and 6.12 B2 (x86).
Re: DLL crashes with PB 6.11
Posted: Fri Aug 16, 2024 4:36 pm
by Fred
Even if it wasn't crashing, I changed the linker to use lld-link, so feel free to test if everything is still OK (dll size should be smaller).
Re: [Done] DLL crashes with PB 6.11
Posted: Thu Sep 12, 2024 11:58 pm
by Jens-Arne
Sorry, this topic isn't done yet. I suggest to remove the [Done] tag.
New Windows 11 update, same old problem in a new fashion.
32bit-DLLs that are compiled with the assembler compiler don't load anymore. This time there's no crash, but the DLL simply won't load, the PB-Identifier returned using #pb_any will be 0.
Please use any simple DLL for testing such as the one Quin postet at the top of the thread.
This time PB V6.01 is affected as well. Very strange, I hope it won't be too much of an effort to dig into this.
x32 with C-backend is still ok, x64 is ok altogether.
Best regards, Jens-Arne
Re: DLL crashes with PB 6.11
Posted: Sun Sep 15, 2024 6:35 am
by Jens-Arne
Ok, now it works once more. So I won't post this problem again until it shows up consistently, what hopefully will never happen.
Re: DLL crashes with PB 6.11
Posted: Sun Sep 15, 2024 8:56 am
by Fred
Moved to Windows forums so we can keep the topic alive