• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Control initialised data layout?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Control initialised data layout?


  • Subject: Control initialised data layout?
  • From: Martin Crane <email@hidden>
  • Date: Mon, 30 Jul 2007 13:58:45 +0100

Hi,

Is there a way to control the layout of the initialized data segment of a MACH-O binary?

The problem I'm having is that some code I am porting expects a static char array, followed by a char array to be in the order defined in the source code, but this isn't the case when compiled with Xcode. I know it sounds horrible (it is!), but the binary is scanned by an external app for copy protection purposes and these two buffers must be laid out correctly in order for it to work. I can't change it... and needless to say, the CodeWarrior (OS 9) and Windows versions don't have this problem.

So, to demonstrate, in the code I have (example, not real!):

static unsigned char gBuffer1[8] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
unsigned char gBuffer2[8] = { 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'};

and the external app expects to see "abcdefghhgfedcba" in the data area of the binary.

Unfortunately, the resultant layout from an Xcode compile gives a binary with this:

"hgfedcba<lots of strings and other data here>abcdefgh"

For what it's worth, this is a Carbon app.

Any suggestions highly welcome!

Regards,

Martin Crane
Macintosh Software Engineer
http://www.vicomsoft.com
Policing For Productivity
________________________________________________________
Vicomsoft is a dynamic market leader in Content Filtering, Internet Connectivity and Firewall Software, with an award-winning portfolio specifically designed for Mac OS X and Windows
________________________________________________________


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Control initialised data layout?
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: Re: System preference pane target in Cocoa application
  • Next by Date: Re: Control initialised data layout?
  • Previous by thread: Re: System preference pane target in Cocoa application
  • Next by thread: Re: Control initialised data layout?
  • Index(es):
    • Date
    • Thread