"Jarrett Billingsley" <[email protected]> wrote in message 
news:[email protected]...
> On Sat, Dec 27, 2008 at 11:33 PM, Plumm <[email protected]> wrote:
>> Hi :
>>
>>   I would like to include a binary file about 64K in my exe to make it a 
>> single executable file, any tip how to make the resouce file? compile the 
>> resource file, and how to access it in the D program? And since I use 
>> DWT, I already linked my program with a dwt.res got from Frank, should I 
>> ask Frank for the rc file so that I can append the binary file into the 
>> rc file?
>>
>> Thanks
>>
>
> Easier even than that.  The import() expression allows you to include
> arbitrary data in your app.
>
> const data = cast(byte[])import("filename.dat");
>
> All you have to do is pass the -J flag to DMD to indicate the path
> where filename.dat lives.  import() returns a string (a char[]) but
> you can cast it to whatever type you want, like I've casted to byte[]
> here.  :)

That would have been great to have back when I was doing GBA homebrew. We 
used to use separate util apps to convert data files into ".h" includes. 


Reply via email to