Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to embed a dll into an exe?

Status
Not open for further replies.

pcwc66

IS-IT--Management
Dec 14, 2001
163
US
I have a vc++ dll which does not require register. Is it possible to just embed it into exe without distributing it?

Thank you for any help.
 
No, you must distribute DLLs separately. If you've ever tried to include a DLL in your project, you'll see that VFP won't let you.



-BP
 
Hi BPeisch,

Thank you for the info. Is it possible in a vc++ dll to check for the existence or a value of a VFP variable or VFP object? If yes, I hope you can give me a simple example.


Thank you for your help.
 
You can embed a .dll file inside an .exe. You just can't declare functions or call them from the DLL without writing it to an external file first.

You could include the DLL in your project with a modified name, say with an underscore added (You have to use an altered name, or code that references the DLL will still "see" the one inside the .EXE - that it can't use). Then before your EXE uses the dll, you would just need to add code to "export" the .dll from within the .exe to an external .dll file.

As long as the .dll is smaller than 16MB, you can use the FILETOSTR() and STRTOFILE() functions. These functions will "see" a file within the .EXE. The code would look something like:

IF !FILE("mydll.dll")
* Assuming that file _mydll.dll was included
* in the project when the .exe was built, the
* next statement will write the _mydll.dll
* file from within the .exe to an external .dll
* file called "mydll.dll".
STRTOFILE(FILETOSTR("_mydll.dll"), "mydll.dll"
ENDIF

... code to declare DLL functions from the DLL, etc.

It probably isn't the best way to distribute a .dll, but if you really want to have a single .EXE file, and don't want to mess with an installer package, this would be one option for distrubuting the DLLs.

Personally, I prefer to create an installer package that includes the VFP runtime files, along with any DLLs you use. It's more user friendly.
 
pcwc66,

I recently created a VC++ DLL, and I send an object as well as 2 by reference variables from VFP to a function in the VC++ DLL. You may want to check it out in relation to your question above regarding VFP Objects and variables and VC++ DLL.

ComputeControlSize MonthView Control Problem
thread184-742345

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top