Page 1 of 1

Create a DLL

Posted: Wed Jan 10, 2024 4:29 pm
by SPH
Hi all,

I need your help.
I want to create a DLL designed by PB5.11
(I want to use 4 instructions from PB5.11 in PB6.00+)
Here is the code I enter in PB5.11:

Code: Select all

ProcedureDLL.q DSolidSprite(Sprite,x,y,Couleur):DisplaySolidSprite(Sprite,x,y,Couleur):EndProcedure
ProcedureDLL.q DShadowSprite(Sprite,x,y):DisplayShadowSprite(Sprite,x,y):EndProcedure
ProcedureDLL.q DTranslucentSprite(Sprite,x,y,Intensity):DisplayTranslucentSprite(Sprite,x,y,Intensity):EndProcedure
ProcedureDLL.q DRGBFilter(x,y,w,h,r,g,b):DisplayRGBFilter(x,y,w,h,r,g,b):EndProcedure
Here is the setting before creating the DLL:
Image

Am I good so far?

Re: Create a DLL

Posted: Thu Jan 11, 2024 5:24 pm
by SPH
I make my DLL from PB64 5.11. It is created.
But when using it, it crashes

[17:23:05] Waiting for the program to start...
[17:23:05] Executable type: Windows - x64 (64bit, Unicode)
[17:23:05] Executable started.
[17:23:05] [ERROR] Scrab_francais_translucent.pb (Line: 317)
[17:23:05] [ERROR] Invalid memory access. (reading error at address 8 )

Re: Create a DLL

Posted: Thu Jan 11, 2024 5:42 pm
by Mijikai
The functions in the dll dont know about the screen that is why it crashes.

Re: Create a DLL

Posted: Thu Jan 11, 2024 5:43 pm
by mk-soft
Clear,

the internal library does not match the new library. In addition, different memory areas and lists are used. A DLL has its own memory management.

Re: Create a DLL

Posted: Thu Jan 11, 2024 6:00 pm
by SPH
Thank you (very much) for your comments.
How to use a DLL then?

Re: Create a DLL

Posted: Thu Jan 11, 2024 10:16 pm
by mk-soft
Then you would have to execute all functions from the DLL.

But this is not allowed. That would be wrapping the PB functions and violates the licence condition of Purebasic