Josh Posted June 4, 2021 Share Posted June 4, 2021 I'm trying to grab the arguments to the main function and pass them onto the C++ application. I am not very well-versed in Obj-C. What am I doing wrong here?: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application NSArray* args = [[NSProcessInfo processInfo] arguments]; std::vector<const char*> arr (args.count); for (int n = 0; n < args.count; ++n) { NSString* s = args[n]; auto cs = [s UTF8String]; arr.push_back(cs); } mymain(int(arr.size()), arr.data()); } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted June 4, 2021 Author Share Posted June 4, 2021 Got it: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application int argc = *_NSGetArgc(); char** argv = *_NSGetArgv(); mymain(argc, (const char**)argv); } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted June 4, 2021 Share Posted June 4, 2021 This is the first Mac thread in 3 years. Are you compiling this as a universal app? 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted June 4, 2021 Author Share Posted June 4, 2021 I don't know, I am just experimenting with it right now. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.