0

I want to Change the parameter between main(line23) and application.Run(argc,argv)(line31)

argc and argv is passed by commandline, but I should judge the parameter before application.Run(), if the commandline has now --url, I should add --url=xx to the argv and pass it to application.Run()

So how can I do that and make the function(application.Run()) run normally?

https://cobalt.googlesource.com/cobalt/+/417b4b4a2ad66d939d77d700eff0f85fb2cb6f16/src/starboard/linux/x64x11/main.cc#23 https://cobalt.googlesource.com/cobalt/+/417b4b4a2ad66d939d77d700eff0f85fb2cb6f16/src/starboard/linux/x64x11/main.cc#31

Devin
  • 1
  • 2

1 Answers1

1

The file starboard/linux/x64x11/main.cc is created specifically for the reference linux-x64x11 platform. If you would like to customize its behavior, for example by augmenting the "--url" parameter, the recommended practice would be to make a copy of starboard/linux/x64x11/main.cc into a file that is now specific to your platform and referenced by your starboard_platform.gyp instead of starboard/linux/x64x11/main.cc, and then modify the copy of it, e.g. by processing the incoming argc and argv and augmenting them in a platform-specific way.

Andrew Top
  • 2,517
  • 1
  • 17
  • 10
  • Thank you for your help. Because we need to pass argc and argv to application.Run(), before we pass it, how can we augmenting the argv, it's for system and seems that we can't modify that. Or if I pass my own parameters to application.Run, How can I keep the format ? Thank you. – Devin Jun 27 '18 at 07:14
  • I would suggest copying the system argc and argv into new strings, modify the copied version, and then pass the copied version through. – Andrew Top Jun 28 '18 at 16:24
  • Thank you, I have tried to use commandline and commandlina->AppendSwitch("url",XXXX) to add the url or other parameters. – Devin Jul 04 '18 at 05:34