HOWTO: Build a Code ResourceLast reviewed: October 8, 1997Article ID: Q129787 |
The information in this article applies to:
SUMMARYYou can use Visual C++ to build Code Resources of type CDEF, cdev, INIT, LDEF, MDEF, WDEF, and XCMD. This article illustrates how.
MORE INFORMATIONApplications use the register A5 to point to their global memory and as a base for intersegment jumps. Stand-alone Code Resources cannot use A5 in this manner. To use global memory in Visual C++, follow these steps:
Sample CodeHere is a sample INIT Code Resource including code and project settings: The C/C++ Project Options:
/nologo /W3 /YX /Oi /D "_WINDOWS" /D "_MAC" /D "_68K_" /D "NDEBUG" /D "_MBCS" /FR"MacRel/" /Fp"MacRel/CodRes.pch" /Fo"MacRel/" /cThe 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 =MAINThe 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 : VCMac kbcode Version : MAC:2.0; Platform : MACINTOSH |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |