Re: Embedding resources in Static Cocoa Library
Re: Embedding resources in Static Cocoa Library
- Subject: Re: Embedding resources in Static Cocoa Library
- From: Simone Tellini <email@hidden>
- Date: Mon, 08 Oct 2012 08:32:39 +0200
Il giorno 08/ott/2012, alle ore 04:23, Alexander Bokovikov <email@hidden> ha scritto:
> As a result, you'll have the address of the embedded information in the eax register. I.e. you just need to create the function declaration like this one:
>
> (void *) myFunc(void);
>
> and call it. Hope this code is close to correct one, as I never dealt with Mac OS assembler. And please take it into account, that "5", mentioned in the code above, means the size of the "jmp L2" instruction, which is five in 32-bit assembler, but it will take nine bytes in the 64-bit one. And of course, I'm talking only about x86/64 assembler. Don't know anything about PowerPC one.
>
> The only what is left out is how to fill out the ".byte" with a useful information. Personally I used a specially written simple utility, transcoding any binary file into the fixed length lines of ".byte " hex codes. You can use decimal or octal codes too. as far as the assembler allows it.
this is way overkill. You can simply write a simple utility to dump the content of your resource in a C file:
static char foo[] = {
0x01, 0x02, 0x03,
...
};
You don't need to use assembly nor to create bogus functions to get the address of foo.
--
Simone Tellini
http://tellini.info
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden