mach-o shared library entry points
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.