yf13 commented on code in PR #2260:
URL: https://github.com/apache/nuttx-apps/pull/2260#discussion_r1459994898


##########
examples/hello_zig/Makefile:
##########
@@ -22,7 +22,7 @@ include $(APPDIR)/Make.defs
 
 # Hello, Zig! Example
 
-MAINSRC = hello_zig_main.zig
+MAINSRC = $(if $(CONFIG_BUILD_KERNEL), hello_zig.zig, hello_zig_main.zig)

Review Comment:
   Yes I think all apps have such requirements to avoid link time name 
collisions. 
   
   For example, the sources of "nsh" and "ostest" both have "main()", but if we 
check the "System.map" of a flat build, we can see only "nsh_main",  
"ostest_main" instead.  the build system redefines the `main()` for C/C++ apps. 
 so entrance naming requirements are not specific to Zig apps.
   
   The problem is that Zig doesn't have macro defintions, thus we can't easily 
redefine the "main" symbol to be "nsh_main" on the command line. 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to