digitalmars.D - [Newbie!!] can I embed a file in my ecutable?
- Digital Mars (4/4) May 14 2011 Let's say I want to use to write a simple installer.
- Jimmy Cao (10/10) May 14 2011 Write a .rc file, and compile it with rcc (from Digital Mars).
- Timon Gehr (6/10) May 15 2011 An alternative to using resources is the following:
- Digital Mars (11/15) May 15 2011 Awesome!! Impressed by D!
- Digital Mars (15/15) May 15 2011 charset="iso-8859-1"
Let's say I want to use to write a simple installer. Can I embed a Zip file inside my executable? If so, how? Thanks! :)
May 14 2011
Write a .rc file, and compile it with rcc (from Digital Mars). That gives you a .res file. So, for example, let's say you want to embed yolk.zip into an exe. First, write yolk.rc with one line: 300 RCDATA "yolk.zip" Then run this: rcc yolk.rc Then do this: dmd egg.d yolk.res Then the egg.exe should have yolk.zip embedded.
May 14 2011
Let's say I want to use to write a simple installer. Can I embed a Zip file inside my executable? If so, how? Thanks! :)An alternative to using resources is the following: auto zip_file = cast(immutable ubyte[])import("zip_file.zip"); You need to specify the -Jpath switch in order for DMD to eat it. Also see http://www.dsource.org/projects/tutorials/wiki/ImportFile . Timon (Also consider digitalmars.D.learn for future questions.)
May 15 2011
Awesome!! Impressed by D! While I'm a .NET enthusiast, the crappy Install project from VS are motivating me to give D a Go! (Pun inside! :) I will also add D.learn to the newsgroup I'm watching then! :) "Timon Gehr" wrote in message news:iqocf4$1ihv$1 digitalmars.com...Let's say I want to use to write a simple installer. Can I embed a Zip file inside my executable? If so, how? Thanks! :)An alternative to using resources is the following: auto zip_file = cast(immutable ubyte[])import("zip_file.zip"); You need to specify the -Jpath switch in order for DMD to eat it. Also see http://www.dsource.org/projects/tutorials/wiki/ImportFile . Timon (Also consider digitalmars.D.learn for future questions.)
May 15 2011
charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thanks, good to know! "Jimmy Cao" <jcao219 gmail.com> wrote in message = news:mailman.179.1305439270.14074.digitalmars-d puremagic.com... Write a .rc file, and compile it with rcc (from Digital Mars). That gives you a .res file. So, for example, let's say you want to embed yolk.zip into an exe. First, write yolk.rc with one line: 300 RCDATA "yolk.zip" Then run this: rcc yolk.rc Then do this: dmd egg.d yolk.res Then the egg.exe should have yolk.zip embedded.
May 15 2011