Article ID: 129787
Article Last Modified on 6/29/2004
#pragma code_seg("MAIN$2")
This forces any declarations that follow to be placed in the second half
of the MAIN Code Resource. The data is referenced as an offset from the
PC register, rather than the A5 register.
/nologo /W3 /YX /Oi /D "_WINDOWS" /D "_MAC" /D "_68K_" /D "NDEBUG" /D
"_MBCS"
/FR"MacRel/" /Fp"MacRel/CodRes.pch" /Fo"MacRel/" /c
The Link Project Options:
libcs.lib /NOLOGO /MAC:bundle /MAC:type="rsrc" /MAC:creator="RSED"
/PDB:"MacRel/CodRes.pdb" /MAP:"MacRel/SACODE.map" /DEBUG /MACHINE:M68K
/NODEFAULTLIB:"swapd.lib" /NODEFAULTLIB /OUT:"MacRel/CODRES.exe"
/entry:main
/section:MAIN,,resource="INIT"@99 /MERGE:CRTSTRING =MAIN
The code for this sample:
#include <string.h>
#include <macos\osutils.h>
#pragma code_seg("MAIN$2")
char _declspec(allocate("_CODE")) java[10] =" Help Me!";
#pragma code_seg("MAIN$1")
void main(void)
{
char bob[10];
bob[0]=0;
strcpy(bob,java);
DebugStr(_c2pstr(bob));
}
This code creates an INIT with a resource ID of 99. There will also be
resources of DATA, CODE, and MSCV. They are not needed for this Code
Resource to function.
Keywords: kbhowto kbcode KB129787