I included the libraries mentioned in "Targeting Mac OS" for a PPC
resource.
When I choose Make I get "undefined '_main' (descriptor)"
I don't know what this means (newbie). My entry point is a function
called "main":
pascal OSErr main (const AppleEvent *theEvent,
AppleEvent *theReply, UInt32 refCon)
I'm not using any global variables.
Every example Scripting Addition I've seen involves a 68K code
resource, not PPC, so am I barking up the wrong tree with trying to
use PPC? The 68K examples start with EnterCodeResource(); I assume
there is something equivalent for a PPC resource, but don't know what.
I'm using CodeWarrior 6.2 on Mac OS 9.0.4.
Thanks for any help!
Tony Green
>PPC Linker -> Entry Points -> Initialization: blank
>PPC Linker -> Entry Points -> Main: _main
>PPC Linker -> Entry Points -> Termination: blank
Should be __initialize, main, __terminate
hth
meeroh
--
Hire me: <http://meeroh.org/hire.html>
Thanks, meeroh, but I still had trouble. With those settings, I got:
"code resource must not have a termination entry-point"
Removing __terminate allowed compile to finish, but the scripting
addition didn't work. Sigh.
Then I discovered Tech Note TN1164, "Native Scripting Additions,"
which explains how to do this. I learned that a native osax is a
shared library, not a code resource, and there is no "Main" entry
point. You write a function that first calls __initialize, passing it
a pointer to a CFragInitBlock. Obtain a AEEventHandlerUPP by calling
NewAEEventHandlerUPP, passing your event handler's name. Then load
your event handler(s) using AEInstallEventHandler. Put this function's
name in PPC Linker -> Entry Points -> Initialization. Write a function
that cleans things up--in this case call AERemoveEventHandler,
DisposeAEEventHandlerUPP, and __terminate() at the end of your
function. Put the function's name in PPC Linker -> Entry Points ->
Termination. This worked fine.
For anyone who's interested, see
<http://developer.apple.com/technotes/tn/tn1164.html>
Also see <http://www.eagrant.com/UniversalOSAX.sit> for Eric Grant's
CodeWarrior post-linker plugin that can create a universal osax that
runs on 68K and PPC from System 7 to OS 10.1. I didn't use the plugin,
but the package includes the source of Marco Piovanelli's "AppleScript
Formatting" osax, which I was able to use as an example. Check out the
Carbon target.
Tony Green