Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with underscores



On Tuesday, October 29, 2002, at 05:51 AM, Peter O'Gorman wrote:

On Tuesday, October 29, 2002, at 02:47 AM, Sean Hinde wrote:
ld -r -u _MD5 -l crypto -o elib.o
cc -bundle -flat_namespace -undefined suppress elib.o -o elibcrypto.so -lc -lcurses -lm


NSSymbol nssymbol = NSLookupSymbolInModule((NSModule*)handle,func_name);
return nssymbol != NULL ? NSAddressOfSymbol(nssymbol) : NULL;


which returns NULL.


Well, looking at the way it is linked, this is not surprising. I don't understand why you can't do:

cc -bundle -flat_namespace -undefined suppress elib.o -o elibcrypto.so -lc -lcurses -lm -lcrypto

Which will ensure that libcrypto is loaded when you NSLinkModule...

What is likely happening here is that when you first try to lookup the symbol in the module, dyld tries to bind the undefined symbols, and because the bundle was not linked against libcrypto, it can't find some of them.

This is actually one the things I have tried. It makes no difference. otool -L also shows that the linking of crypto from the first line is happily carried through into the final product.



You should be calling NSLinkEditError if nssymbol is null to check why.


Thanks, I'll try this.

Sean
_______________________________________________
unix-porting mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/unix-porting
Do not post admin requests to the list. They will be ignored.



References: 
 >Re: Trouble with underscores (From: "Peter O'Gorman" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.