[net.micro.mac] Aztec C and Resources: A Tip

smith@umn-cs.UUCP (01/15/86)

  Being a relative newcomer to Macintosh software development I've never had
to use RMaker or any other resource 'compiler';  I've always used resource
editors of some version or other.  The big problem with using resources
is, of course, to get them into the same file as your compiled code.  Ideally
the compiler/linker should put their CODE resources into the output file
without touching other resources already in the file.  I use Aztec C which
apparently zeroes the whole output file before putting its code into the file.
What you have to do is copy the CODE resources from the executable file
into the file containing the rest of the resources.  You can do this with
ResEdit, but it's painful to do repeatedly during debugging.

  I used the Apple development hack for a while.  That's where you have
two distinct files -- a 'resource' file created by RMaker, ResEdit, or
something, and an 'executable' file containing the latest version of
the compiled code.  The code includes a call to OpenResFile to find the
program's resources.  This approach works, but it looks silly if your
application has its own desktop icon, since the icon will be on the
resource file instead of the code file.

  The best solution for Aztec C appeared after I did some poking around.
Aztec C comes with a utility called 'cprsrc' ('copy resource') that copies
a numbered resource of a given type from one file to another.  So I now
have an Aztec C shell script that links my program and then copies the
three CODE resources from the linker output into the file with the rest
of my resources, overwriting the previous code.  Works like a charm.

Rick.
<...!ihnp4!umn-cs!smith>