DLL's
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
Maybe someone out there can help me??
I need to access functions in a DLL. I have tried Mr.Skunks library but it either doesn't work properly/doesn't return the proper data, or it crashes the EXE.
I went to the Windows API and can load the DLL using LoadLibrary() and can even get the address of the various commands inside the DLL using GetProcAddress() but after that I hit a brick wall... I can't seem to find any commands or reference to commands that actually send/receive arguments to the DLL.
Can anyone point me in the right direction??
Maybe someone out there can help me??
I need to access functions in a DLL. I have tried Mr.Skunks library but it either doesn't work properly/doesn't return the proper data, or it crashes the EXE.
I went to the Windows API and can load the DLL using LoadLibrary() and can even get the address of the various commands inside the DLL using GetProcAddress() but after that I hit a brick wall... I can't seem to find any commands or reference to commands that actually send/receive arguments to the DLL.
Can anyone point me in the right direction??
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
I havent tested this:
Hope it works. Bye,
El_Choni
Edited by - El_Choni on 07 February 2002 03:19:55
I havent tested this:
Code: Select all
If LoadLibrary_("MySystemLib.dll")
arg1.l = 1
arg2.l = 2
arg3.l = 3
result.l = 0
FunctionPointer = GetProcAddress_(whatever goes here... )
! push dword [v_arg1]
! push dword [v_arg2]
! push dword [v_arg3] ; or maybe in reverse order, I don't remember
call FunctionPointer
! mov [v_result], eax
EndIf
El_Choni
Edited by - El_Choni on 07 February 2002 03:19:55
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
This works, with inline asm enabled:
Bye,
El_Choni
Edited by - El_Choni on 07 February 2002 12:19:46
This works, with inline asm enabled:
Code: Select all
module = LoadLibrary_("USER32.DLL")
If module
result = 0
MessageBox = GetProcAddress_(module, "MessageBoxA")
If MessageBox
Caption.s = "MessageBox function"
Message.s = "Working"
push dword 0
push Caption
push Message
push dword 0 ; the order seems correct
call MessageBox
mov result, eax
EndIf
EndIf
El_Choni
Edited by - El_Choni on 07 February 2002 12:19:46
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Paul.
The call I have to make looks like this:
Error.l=BoxReady(LPT1.l,Type.l)
Value going in is LPT.l=1
Return values are Error and Type
So I need something that will return 2 values.
If I try to modify your code I get either EXE has generated errors or Assembly error, mail Fred
The call I have to make looks like this:
Error.l=BoxReady(LPT1.l,Type.l)
Value going in is LPT.l=1
Return values are Error and Type
So I need something that will return 2 values.
If I try to modify your code I get either EXE has generated errors or Assembly error, mail Fred

-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
If Type is a return value, then you should probably pass its pointer instead of its value.
Try it. Anyway, I don't know if LoadLibrary can load any library or only registered libraries or only libraries present in the System folder, you may know that.
Bye,
El_Choni
Edited by - El_Choni on 07 February 2002 14:58:15
If Type is a return value, then you should probably pass its pointer instead of its value.
Code: Select all
module = LoadLibrary_("YourLib.DLL")
If module
result = 0
BoxReady = GetProcAddress_(module, "BoxReady")
If MessageBox
LPT1.l = whatever
Type.l
varptr.l = @Type
push LPT1
push varptr ; the order seems correct
call BoxReady
mov Error, eax ; Type is already updated
EndIf
EndIf
Bye,
El_Choni
Edited by - El_Choni on 07 February 2002 14:58:15
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Shawn.
Thanks.
Shawn
I did miss it in the documentation. See "Library" in the reference section. It is not yet listed on the main page.Hi.WIll be in the next release. Don't worry
Fred - AlphaSND
Did the DLL support get pushed back to a later release, or did I miss it in the documentation?
Thanks.
Shawn
Thanks.
Shawn
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm