RE: How can I use a .dylib created in Xcode in my gcc-compiled program?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Importance: Normal Boris Remizov said:
Hmmm...> Try to play with extern "C" directive before your func ().
That is only part of the solution. For example, if I have a library I made named libmine.dylib, I can compile my program in two ways: g++ main.cpp libmine.dylib -o run (assuming libmine.dylib is in the same directory) or g++ main.cpp -L. -lmine -o run In both cases it compiles (what is the difference??), but I get the following error when I try to execute the program: $ ./run dyld: Library not loaded: /usr/local/lib/libmine.dylib Referenced from: /Users/milford/program/./run Reason: image not found Trace/BPT trap Another thing I've noticed...if I compile a .dylib in Xcode with the C compiler, I can call a function from the library in a separate program, but if I recompile the .dylib using the C++ compiler (no changes to the code though!) I can't even compile and link the program that uses the library. I'm aware these are very trivial problems, and ordinarily I can figure them out myself with ease, but not in this case because of the total lack of documentation! I can't find documentation on building .dylibs with Xcode or on using them. I am pretty green with OS X development, if anyone could point me in the right direction that'd be great. If documentation exists, I can figure it out myself, but without it I'm just grappling in the darkness :( Thanks, Milford _________________________________________________________________ Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailn... _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Milford Brimdash