See:http://www.powerbasic.com/support/pb...907#post319907
For an example of how I add embedded files to a resource.
James
Announcement
Collapse
No announcement yet.
Is it possible to embed a DLL within an EXE
Collapse
X
-
>That would do but when you wish to use declares pointing to a dll you cannot.
What you do want? A free lunch?
If you want "no external DLL to ship but access to functions in that DLL" it costs you the convenience of "DECLARE FUNCTION...LIB .. ALIAS... " and you have to use LoadLibrary() + GetProcAddress() + CALL DWORD.
The little bit of extra effort is either worth it to you or it ain't.
MCM
Leave a comment:
-
-
That would do but when you wish to use declares pointing to a dll you cannot.
Leave a comment:
-
-
Usually not a problem, but for "Paranoids" (like me) that do not like seeing things happening that they did not expect
Of course, maybe I'm just fixated on the concept that that's why there is such a thing as a "temp" folder in the first place.
MCM
Leave a comment:
-
-
MCM
Huh? That's what my suggestion accomplishes. The DLL I stored as a resource was not mine, it was the zlib DLL.
The user never knows, unless he puts a monitor on his Temp folder and makes enough observations to conclude that because when the Tour Application starts a file is created, that file is "in use" until the tour application ends, and is deleted when the application ends, therefore the tour application must be creating and destroying that file. However, that's still only a guess.
I think Gary was more looking for (can I embed a DLL in a resource, and use it, but not create the dll to use it, but rather use the function in memory so that the process is completely oblivious to the user at runtime)
MCM
The user never knows, unless he puts a monitor on his Temp folder and makes enough observations to conclude that because when the Tour Application starts a file is created, that file is "in use" until the tour application ends, and is deleted when the application ends, therefore the tour application must be creating and destroying that file. However, that's still only a guess
Usually not a problem, but for "Paranoids" (like me) that do not like seeing things happening that they did not expect, then could wreak some havoc.
Although I would suspect that zlib.dll would be the most likely used dll for this kind of use (I think I used it somewhere), I think there was some sort of problem about using it without recognition (Maybe it was a M$ lawsuit or something in the past) I will try to do a example using a plain DLL to demo.
I thought I had posted before, but the only code I can find is on my own machine and appears to be a "Work-in-progress" so I will see if I can clean it up and post shortly.
Leave a comment:
-
-
I've used this approach for one application where I wanted to ship a zlib DLL library inside my exe and load the dll directly from memory without touching the disk. The advantage being that there is nothing to tidy up afterwards on disk.
' load the ziplib directly
' return in a string the contents of the zip dll
szRawZip = funReturnZiplib
' load the dll directly into memory and store its handle in zlib_hdll
IF LoadPbDllFromMemory (STRPTR(szRawZip), LEN(szRawZip), ZLIB_hDll) THEN
funGraphicUpdate("STATUS", "Unable to load Zip Dll")
EXIT FUNCTION ' handle errors
END IF
szRawZip = "" ' We don't need it anymore
Leave a comment:
-
-
I think Gary was more looking for (can I embed a DLL in a resource, and use it, but not create the dll to use it, but rather use the function in memory so that the process is completely oblivious to the user at runtime)
The user never knows, unless he puts a monitor on his Temp folder and makes enough observations to conclude that because when the Tour Application starts a file is created, that file is "in use" until the tour application ends, and is deleted when the application ends, therefore the tour application must be creating and destroying that file. However, that's still only a guess.
MCM
Leave a comment:
-
-
Thanks Cliff, and yes, that was the thought.
I'll watch for your next post.
Leave a comment:
-
-
I think Gary was more looking for (can I embed a DLL in a resource, and use it, but not create the dll to use it, but rather use the function in memory so that the process is completely oblivious to the user at runtime)
Gary the answer is YES (although depending on what you want to do you will need to use a small amount of Assembly, although that is my take on it so far)
I did a look and could not find it, but give me a bit and I will see if I can post an example.
Leave a comment:
-
-
Code:// myprog.rc resource script 101 RT_RCDATA "mydll.dll"
That's what I did at One From Column A, One from Column B.. Works good.
MCM
Leave a comment:
-
-
-
Is it possible to embed a DLL within an EXE
In the opposite direction of my last post, can I incorporate a DLL in my EXE?
I'd prefer that the DLL not be automatically extracted when the program runs, but for now I'm just trying to understand what is possible.
It seems like I've seen info on it in the past, but my forum searches have come up short.Tags: None
-
Leave a comment: