Page 1 of 1

Is it possible to include DLLs ?

Posted: Mon Jul 15, 2024 9:13 pm
by flashbob
Is it possible to include external DLLs similar to image files (see command IncludeBinary ) ?
I only want to deliver my program as a single file and images / external libraries should be included.
Thx!

Re: Is it possible to include DLLs ?

Posted: Mon Jul 15, 2024 9:29 pm
by jacdelad
Yes, you can include every type of you want to. You need to copy the included DLL to a temporary directory or you can load it from memory (there's code for that somewhere here, I just don't know where).

Re: Is it possible to include DLLs ?

Posted: Mon Jul 15, 2024 9:46 pm
by Quin
I typically do it with a DataSection and IncludeBinary, extracting to %TEMP%. For me it was an updater executable, not a DLL, but my code worked like:

Code: Select all

Temp$ = GetEnvironmentVariable("TEMP")
FileID = CreateFile(#PB_Any, Temp$ + #PS$ + "Updater.exe")
If Not FileID
  ; ...
EndIf
WriteData(FileID, ?Updater, ?EndUpdater - ?Updater)
CloseFile(FileID)
RunProgram(Temp$ + #PS$ + "Updater.exe", "", GetCurrentDirectory())
THen in my data section, I have:

Code: Select all

	Updater:
	IncludeBinary "Updater.exe"
	EndUpdater:
HTH

Re: Is it possible to include DLLs ?

Posted: Tue Jul 16, 2024 12:38 pm
by flashbob
... ok, thanks for the example. I don't want to copy the file (DLL) to a temp directory. So I I'm looking for an example to load the dll directly into memory ...

Re: Is it possible to include DLLs ?

Posted: Tue Jul 16, 2024 6:45 pm
by morosh