site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Ronnie On Mar 22, 2007, at 2:39 AM, Jonas Maebe wrote: On 22 Mar 2007, at 10:23, Filipe Cabecinhas wrote: _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... You may be able to extract minimal bits of crt1.o to set up enough state to make dyld stubs work. However, once you start wanting to call out to libSystem, you'll probably need the crt externs to be set up (NXArgc/NXArgv, environ, etc.), and you'll need to call the appropriate Libc init code. You'll probably also have to properly align the stack. What I'm trying to suggest is that it's not worth duplicating all of crt1.o -- you should just link to the crt1.o already provided by the system, and have main call to your entry point. This suggests to me that dyld doesn't get initialised properly. Have you tried linking in /usr/lib/crt1.o already? In that case, you may not be able to specify an alternate entry point though. Another option may be to add the source code of crt1.o to your program so you can change its symbol names for entry point and where it jumps to in your program after it finishes initialising, but note that it was quite a convoluted mess the last time I looked at it. If it's publicly available could you show me that library so I could see how you've done that? Our source code is available, but I'm not sure if it'll be of much use of you since it's all written in Pascal (it's part of the run time library for the Free Pascal Compiler). If you want, I can point you to the files in question. But I'm not sure what you are referring to with "it". To clarify: I have not integrated the source code of crt1.o in our run time library. What we do is give our entry point the assembler name "_main" and link in crt1.o. crt1.o simply calls _main after it's finished with doing its thing, and the application takes over from there. This is the same way it works for gcc and (almost?) any other compiler which generates programs for Mac OS X. Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/rgmisra% 40apple.com This email sent to rgmisra@apple.com This email sent to site_archiver@lists.apple.com