Skip navigation.
 
mlRe: Getting binary data linked into an executable
FROM : Edward Patel
DATE : Mon Jun 02 21:20:52 2008

Checkout xxd. It's a versatile hexdump tool that can output in C 
language

man xxd

example

xxd -i somefile.dat > someheader.h


/Edward



On 2 jun 2008, at 21.02, Paul Thomas wrote:

>
> On 2 Jun 2008, at 19:55, SD wrote:
>

>> Would memory mapping the files work for you?

>
> It's not the particular API, I want to avoid accessing the disk at 
> all to get the data.
> I want the data linked into the executable in the data segment. 
> (it's a unit test)
>

>>
>>
>> ______________________________________________________________________
>> Previous message from Paul Thomas on 6/2/08 at 7:53 PM +0100
>> **********************************************************************

>>> I've got some huge test data that I need to access as C arrays 
>>> inside a command line test app. I don't want use file I/O at 
>>> runtime and the compiler is groaning under the weight if I 
>>> generate source files with the data in hex or what have you.
>>>
>>> Does anyone know a way to simply link the data into my executable?
>>>
>>> It seems that most ELF systems allow this using GNU objcopy or 
>>> even ld (ld -r) but apple's tools aren't playing ball.
>>>
>>> ta,
>>> pt.
>>> _______________________________________________
>>> MacOSX-dev mailing list
>>> <email_removed>
>>> http://www.omnigroup.com/mailman/listinfo/macosx-dev

>>
>>
>> --
>> ==========================================
>> SD
>>
>> WARNING: Programming may be habit forming.

>
> _______________________________________________
> MacOSX-dev mailing list
> <email_removed>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev

Related mailsAuthorDate
mlGetting binary data linked into an executable Paul Thomas Jun 2, 20:53
mlRe: Getting binary data linked into an executable Paul Thomas Jun 2, 21:02
mlRe: Getting binary data linked into an executable Edward Patel Jun 2, 21:20
mlRe: Getting binary data linked into an executable James Montgomerie Jun 3, 11:17
mlRe: Getting binary data linked into an executable Michael Vannorsdel Jun 3, 11:56
mlRe: Getting binary data linked into an executable Markus Hitter Jun 3, 13:16