How can I use a .dylib created in Xcode in my gcc-compiled program?
How can I use a .dylib created in Xcode in my gcc-compiled program?
- Subject: How can I use a .dylib created in Xcode in my gcc-compiled program?
- From: Milford Brimdash <email@hidden>
- Date: Wed, 10 Oct 2007 20:54:22 +0000
- Importance: Normal
Howdy,
I've spent a few hours trying to do somethin' very simple: I have a .dylib I created in Xcode (BSD Dynamic Library) that I want to use in a command-line program I am compilin' with gcc.
How do I do this? The following page is the only help I've found on includin' a .dylib when using gcc:
http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/Articles/CreatingDynamicLibraries.html#//apple_ref/doc/uid/TP40002073-SW1
Based on it, I am tryin':
$ g++ main.cpp Lib.dylib -o test
But I get the followin' errors:
/usr/bin/ld: Undefined symbols:
func()
...
etc.
The queer thing is, if I take .c and .h files from the Xcode project and compile 'em into a .dylib by hand, like so:
$ g++ -dynamiclib Lib.c -o Lib.dylib
Then I can compile my program just fine, as above! This solution ain't acceptable, however, because then the .dylib won't work with Maple11 worksheet for some reason.
When I look at the build details in Xcode, I see all sortsa flags like like -fpascal-strings and -no_farm_animals but I have no idea why the same exact code compiled by Xcode works in Maple11 but not with my gcc-compiled program, but the gcc-compiled .dylib works with my gcc-compiled program but not Maple11! (Tarnation!)
Any help will be 'ppreciated.
Milford Brimdash
(ps. usin' Xcode to write my command-line program is out, since when I right-click on "Link Binary with Libraries" and add the Lib.dylib, it then complains durin' build that "can't locate file for: -ILib")
_________________________________________________________________
Help yourself to FREE treats served up daily at the Messenger Café. Stop by today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden