DLL crashes with PB 6.11

Windows specific forum
Jens-Arne
User
User
Posts: 43
Joined: Sun Feb 04, 2024 11:09 am

DLL crashes with PB 6.11

Post 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
Last edited by Jens-Arne on Sun Aug 04, 2024 4:16 pm, edited 1 time in total.
Quin
Addict
Addict
Posts: 1125
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: DLL crashes with PB 6.11

Post 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
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DLL crashes with PB 6.11

Post 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")
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: DLL crashes with PB 6.11

Post 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.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DLL crashes with PB 6.11

Post by Fred »

The crash should be with 6.11 :)
User avatar
mk-soft
Always Here
Always Here
Posts: 6204
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: DLL crashes with PB 6.11

Post 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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: DLL crashes with PB 6.11

Post by Denis »

Work here with Windows 11 Professionnel version 23H2
PB 6.12b2, x86
A+
Denis
Jens-Arne
User
User
Posts: 43
Joined: Sun Feb 04, 2024 11:09 am

Re: DLL crashes with PB 6.11

Post 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?
Last edited by Jens-Arne on Sat Aug 17, 2024 10:37 pm, edited 1 time in total.
Quin
Addict
Addict
Posts: 1125
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: DLL crashes with PB 6.11

Post 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).
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DLL crashes with PB 6.11

Post 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).
Jens-Arne
User
User
Posts: 43
Joined: Sun Feb 04, 2024 11:09 am

Re: [Done] DLL crashes with PB 6.11

Post 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
Jens-Arne
User
User
Posts: 43
Joined: Sun Feb 04, 2024 11:09 am

Re: DLL crashes with PB 6.11

Post 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.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DLL crashes with PB 6.11

Post by Fred »

Moved to Windows forums so we can keep the topic alive
Post Reply