• 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
AESend() error - unknown symbol '_AESend'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AESend() error - unknown symbol '_AESend'


  • Subject: AESend() error - unknown symbol '_AESend'
  • From: Yogesh P <email@hidden>
  • Date: 25 Aug 2005 19:28:00 +0530

Hi Folks,

I have implemented one daemon process and one sample Cocoa application.
My daemon process exe is "mydaemon" and my application exe is "myapp".

Now to implement Apple event in my daemon so that my daemon start my
sample application i have implemented the following code snippet.

static int myDaemon(void)
{
   * call fork()
   while(1)
   {
	/* Initialize and set up Start MyApp Apple Event */
        InitstartMyAppAE();
        Boolean startMyApp = True;
        /* Start MyApp Application */
	startMyApp(startMyApp);
	sleep(30);
   }
   return 0;
}

/* Initialize and set up start MyApp Apple Event */
void InitstartMyAppAE(void)
{
    NSLog(@"InitstartMyAppAE");
    OSErr err;
    err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,

NewAEEventHandlerUPP((AEEventHandlerProcPtr)startMyAppAEHandler), 0,
false);
}
static OSErr startMyAppAEHandler(const AppleEvent *appleEvt, AppleEvent*
reply, UInt32 refcon)
{
    NSLog(@"startMyAppAEHandler");
    gOpenFlag =  true;
    return noErr;
}
void startMyApp(Boolean startMyApp)
{
    NSLog(@"startMyApp");
    // --- Allocating local variables --- //
    ProcessSerialNumber processSN = {kNoProcess, kNoProcess};
    ProcessInfoRec infoRec;
    Str31 processName;
    FSSpec procSpec; //added
    OSErr error, otherError;
    do
    {
        NSLog(@"Inside do of startMyApp");
        error = GetNextProcess(&processSN);
        infoRec.processInfoLength = sizeof(ProcessInfoRec);
        infoRec.processName = (unsigned char*)&processName;
        infoRec.processAppSpec = &procSpec; // added
        otherError = GetProcessInformation(&processSN, &infoRec);
        if(otherError == noErr)
        {
            NSLog(@"Inside otherError == noErr");
            if(sprintf(processName, "%s", (char*)"myapp")) // myapp
						     - name of 						    my application
            //if(SameString((char *)"\pmyApp",(char*)&processName))
            {
                printf("\n processName = %s\n", processName);
                NSLog(@"Calling SendStartAEToMyApp");
                (void)SendStartAEToMyApp(processSN);
            }
        }
    }
    while(error == noErr);
}
OSErr SendStartAEToMyApp(ProcessSerialNumber ProcessToStart)
{
    NSLog(@"SendStartAEToMyApp");
    OSErr error;
    AEAddressDesc targetDesc;
    AppleEvent theEvent;
    AppleEvent eventReply = {typeNull, NULL};
    error = AECreateDesc(typeProcessSerialNumber, &ProcessToStart,
				sizeof(ProcessToStart), &targetDesc);
    if(error != noErr){
        NSLog(@"AECreateDesc() error code is %d", error);
        return (error);
    }
    error = AECreateAppleEvent(kCoreEventClass, kAEOpenApplication,
		&targetDesc, kAutoGenerateReturnID, kAnyTransactionID, 			&theEvent);
    if(error != noErr){
        NSLog(@"AECreateAppleEvent() error code is %d", error);
        return(error);
    }
    AEDisposeDesc(&targetDesc);
    error = AESend(&theEvent, &eventReply, kAENoReply,
	kAENormalPriority,kAEDefaultTimeout, NULL, NULL);
    if(error != noErr){
       NSLog(@"AESend() error code is %d", error);
        return(error);
    }
    AEDisposeDesc(&theEvent);
    AEDisposeDesc(&eventReply);
    return(error); // If this is noErr then we are successful.
}

But when i run this code snippet i am getting the following error.
ZeroLink: unknown symbol '_AESend'

My logs are as follows:

2005-08-25 18:48:26.271 MyDaemon[1417] main
2005-08-25 18:48:26.273 MyDaemon[1417] Successfully fork the parent
process !!!
2005-08-25 18:48:26.273 MyDaemon[1417] pidfilename = /etc/config.pidfile
2005-08-25 18:48:26.280 MyDaemon[1418] MyDaemon Daemon Starts !!!
2005-08-25 18:48:26.282 MyDaemon[1418] InitstartMyApp
2005-08-25 18:48:26.283 MyDaemon[1418] startMyApp
2005-08-25 18:48:26.283 MyDaemon[1418] Inside do of startMyApp
2005-08-25 18:48:26.308 MyDaemon[1418] Inside otherError == noErr
processName = MyApp
2005-08-25 18:48:26.308 MyDaemon[1418] Calling SendStartAEToMyApp
2005-08-25 18:48:26.308 MyDaemon[1418] SendStartAEToMyAppe
ZeroLink: unknown symbol '_AESend'

MyDaemon has exited with status 0.

Does am i doing something wrong in AESend() function???

Please guide me to solve this problem.

Thanks in advance,
Yogesh Pahilwan











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

This email sent to email@hidden

  • Follow-Ups:
    • Re: AESend() error - unknown symbol '_AESend'
      • From: "Sean McBride" <email@hidden>
  • Prev by Date: Re: Load a WebView with contents of NSString
  • Next by Date: Finding all subclasses of a class ?
  • Previous by thread: current predicate of a NSSearchField
  • Next by thread: Re: AESend() error - unknown symbol '_AESend'
  • Index(es):
    • Date
    • Thread