• 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
mach-o shared library entry points
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mach-o shared library entry points


  • Subject: mach-o shared library entry points
  • From: boga <email@hidden>
  • Date: Mon, 31 May 2004 08:41:38 +0200

We use the --init ld option.
It is in the General/"Initialization routine" option in XCode.


General/Initialization routine: MyInitImage

extern "C" int MyInitImage (void);
int MyInitImage (void)
{
}

To get the path of the current dyld you can use:

#include <mach-o/ldsyms.h>
#include <mach-o/dyld.h>
char* getmypath()
{
     mach_header* header = 0;
     header = _mh_dylib_header;
     const char* imagename = 0;
     int cnt = _dyld_image_count();
     for (int idx1 = 1; idx1 < cnt; idx1++) {
		if (_dyld_get_image_header(idx1) == header)
			imagename = _dyld_get_image_name(idx1);
	}
     /* The posix path of the dylib is in imagename */
     return imagename;
}

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


  • Follow-Ups:
    • Re: mach-o shared library entry points
      • From: Brian Greenstone <email@hidden>
  • Prev by Date: Re: Thank you!
  • Next by Date: Cross-Development with 10.2.7 SDK
  • Previous by thread: mach-o shared library entry points
  • Next by thread: Re: mach-o shared library entry points
  • Index(es):
    • Date
    • Thread