• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Compiling Shared Objects/Libraries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling Shared Objects/Libraries


  • Subject: Re: Compiling Shared Objects/Libraries
  • From: Richard Schreyer <email@hidden>
  • Date: Tue, 29 Jan 2002 12:33:24 -0800

I'm looking through dyld.h, and no single function seems to be jumping out at me saying that it's equivalent to dlopen().

From what I'm seeing, I guess that I have to create a NSObjectFileImage to represent the .dylib file, and then use NSLinkModule() (can I use anything for the moduleName string?) to load the library?

Finally, it appears that NSLookupAndBindSymbol() is used instead of dlsym().

Is all of this right, and is there anyplace I can find some real documentation for dyld.h? It's barely mentioned on developer.apple.com.

Thanks again,
Richard Schreyer

On Monday, January 28, 2002, at 05:02 PM, George Warner wrote:

I need to get a windows/linux program working on os x for an AI class.
The application manages and scores a game of Go. Bots are created by
subclassing the app's PlayerProxy class (in c++). Then (on linux), they
are loaded into the application at runtime as a shared object (.so) file.

I've downloaded and installed dlfcn.h, so I should be able to load the
bot classes with dlopen(), but I haven't been able to figure out how to
compile the bot classes themselves so they can be loaded into the
program.

[From our guru
]

Umm... dlopen() and family are routines implemented originally in Solaris (I
believe), and are not supported on Mac OS X. There is a compatibility
library available as part of Fink on sourceforge.net, called "dlcompat",
that should help in the porting, but there is no direct one-to-one
just-recompile option for those who have existing code that uses dlopen().
Anyway, chances are what this guy wants is to create dynamic libraries
(.dylib files) using the -dynamiclib compiler flag (name the library
libfoobar.dylib for best results, although this is not strictly required by
the runtime). Then in-code use the low-level routines in
/usr/include/mach-o/dyld.h. If he's writing the code himself, he could use
higher-level easier-to-use APIs like CFBundle if he wants, I suppose.

[END]

--
Enjoy,
George Warner,
Mixed Mode Magic Fragment Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Compiling Shared Objects/Libraries
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Preopen a drawer
  • Next by Date: Re: Getting a file's icon > 32x32 (Solved)
  • Previous by thread: Preopen a drawer
  • Next by thread: Re: Compiling Shared Objects/Libraries
  • Index(es):
    • Date
    • Thread