On Sep 8, 2006, at 11:33 AM, Jeremy Bettis wrote:
Adrian Robert wrote:
Hi,
I'm getting a linking error that I'm trying to track down:
/usr/local/GNUstep/System/Library/Libraries/libgnustep-base.so:
undefined reference to `gnustep_base_user_main'
I find that gnustep_base_user_main() is *called* in
NSProcessInfo.m, and sometimes when running in a debugger I've
seen that the main() function in user code is somehow
automagically mapped to this name. Since it seems like that is
NOT happening in my case, I was wondering, HOW is this supposed to
be done?
I'm not really an expert on the ins and outs of .o and executable
file formats, loading, linking, and running, so a simple
explanation would be appreciated. ;)
It varies by platform. If your platform doesn't have any better
support for getting the arguments and env vars, then
NSProcessInfo.h #define's main to gnustep_base_user_main. main is
declared in NSProcessInfo.m (or nearby) and it calls your real main
(gnustep_base_user_main).
It's messy and icky, and if your platform has a better way of
dealing with it, then it should be implemented. As far as I know
there are special cases for Linux (all glibc platforms maybe?),
Solaris, & Win32 that do not #define main, but use some os specific
hacks to get the argument list.
Thanks, that explains everything. (I had missed the #define occurs
in GSConfig.h..)
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev