View Full Version : working with multiple Targets
ruhi
Aug 4, 2009, 08:11 AM
Hello All,
In my cocoa application i am having two targets, each with associated classes and Nibs.
I have a single main() for now.
I want to run my one target from another target's code.
i think i need two separate main() function for eg: App1Main() and main() for both the targets. but how can i call one App1main() function from main().
I guess i need to call NSApplicationMain but how ?? what arguments??
Please help.
Thanks,
Ruhi.
robbieduncan
Aug 4, 2009, 08:35 AM
Build App1 as an application, include that in the main app in the resources via a Copy File build phase then use the standard NSBundle methods to get the path to that executable and run if via the normal methods for running an executable (you can't directly call it's main function you need to use NSTask).
ruhi
Aug 6, 2009, 12:29 AM
what is the other method using NSTask. I want to know that too so that i could find the better one according to my requirement.
Thanks,
Ruhi.
robbieduncan
Aug 6, 2009, 03:50 AM
what is the other method using NSTask. I want to know that too so that i could find the better one according to my requirement.
Thanks,
Ruhi.
Read the documentation then ask specific questions posting the code you are using: I'm not about to write the code for you. Stop being so lazy.
ruhi
Aug 6, 2009, 04:38 AM
Sorry to say, But i have already done lot of research and then posted this query on the forum for help.
I dnt find any way to call main() from NStask, though there are some methods to launch Path but still running second app's main() is what i desired.
Thanks,
ruhi.
robbieduncan
Aug 6, 2009, 04:44 AM
Sorry to say, But i have already done lot of research and then posted this query on the forum for help.
I dnt find any way to call main() from NStask, though there are some methods to launch Path but still running second app's main() is what i desired.
Thanks,
ruhi.
You don't call main(). You start a new process. The OS calls main(). That's what it's there for.
ruhi
Aug 6, 2009, 04:50 AM
Thanks.
I am adding a build phase rather than using NSTask.
There are many options for adding a build phase like:
Copy Files Build Phase
Compile Sources Build Phase
etc.
i am not able to add either of them.
Can you tell me the suitable one that will do my task?
Thanks,
Ruhi
robbieduncan
Aug 6, 2009, 05:42 AM
Thanks.
I am adding a build phase rather than using NSTask.
This makes no sense at all: they do completely different and unrelated things.
There are many options for adding a build phase like:
Copy Files Build Phase
Compile Sources Build Phase
etc.
i am not able to add either of them.
Can you tell me the suitable one that will do my task?
Thanks,
Ruhi
I've no idea. Build Phases have nothing to do with calling another executable from within yours (and "calling main()" is another executable).
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.