I am trying to understand how various ebook applications compile their output into a self-contained executable file with no dependencies when you run the exe. How can it be done? Do they use real embedded compiler?
I am trying to understand how various ebook applications compile their output into a self-contained executable file with no dependencies when you run the exe. How can it be done? Do they use real embedded compiler?
>> various ebook applications
"ebook" is a broad term. What particular application(s) are you referring to?
>> self-contained executable file with no dependencies when you run the exe. How can it be done? Do they use real embedded compiler?
Define "no dependancies". As in "running depends.exe shows no dependancies"?
Compile a program (this will be your generated app), and make it read one of it's resources for instructions on what to do. Put this program within your parent program's resources.
Now, to 'generate' your application, extract the resource to an exe file, and update the extraction's resources via UpdateResource(), giving the generated application it's uniqueness.
>> Compile a program (this will be your generated app), and make it read one of it's resources for instructions on what to do.
Oh that makes sense. I thought he was talking about "dll dependencies", but he probably was referring to the actual book data.
Yarin
does it creates one single exe file ?
with no configurations or data files that this exe depends on it ?
can you please give me links for examples?
Thanks allot
>> does it creates one single exe file ?
Yes, using Windows resources, you can store just about anything in the executable. Most compilers come with a resource compiler.
does it load it on run time ?
one thing i dont understand here ..
lts say i build the exe in my compiler then i direct it to load resource file .
now i like to be able to give the users to make there own content and then
my application ( that dont contains compiler ) will save it as single exe.
who does it work ?
>> who does it work ?
I already told you.
When the user wants to "create" their own app. Just extract the one you have in the program's resources. Then make the same program update the resources of the extraction right away.
Inside your 'custom' program, you'll have code that does different things depending on the resources that got updated.
In reality, each "created" app would be the same thing, (with different resources) but the end user wouldn't notice. :) This way, no embedded compiler, or anything else super-complicated, would be required.
Very often, programming is all about trickery.;)
Thanks for the fast reply
can you please point me to some tutorials or links
Thanks
Assuming that you have, at this point, a resource compiler handy and have already added a resource to your application, you just need to call FindResource and LoadResource to retrieve it. To do that, you're going to need a few pieces of information:
1) Your applications HMODULE value. You can use GetModuleHandle(NULL), or simply your application's HINSTANCE to fetch this value.
2) The name or ID of the resource. If it's an ID, you'll need to use the MAKEINTRESOURCE macro to "convince" the compiler that it's a string (it's just a Windows kludge, don't worry about the details, for now).
3) The type of resource (eg: RT_ACCELERATOR, RT_ANICURSOR, RT_ANIICON, RT_BITMAP, RT_CURSOR, RT_DIALOG, RT_FONT, RT_FONTDIR, RT_GROUP_CURSOR, RT_GROUP_ICON, RT_ICON, RT_MENU, RT_MESSAGETABLE, RT_RCDATA, RT_STRING, or RT_VERSION)
4) The value returned by FindResource.
Now just pass #1, #2, and #3 to FindResource, and then #1 and #4 to LoadResource. That's basically it.
EDIT:
It looks like you can simply use the value NULL for #1. Either way should work, though.