Skip to content

Instantly share code, notes, and snippets.

@prophile
Created April 23, 2009 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prophile/100659 to your computer and use it in GitHub Desktop.
Save prophile/100659 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
#import <objc/objc.h>
#import <dlfcn.h>
const char *class_getImageName(Class cls)
{
int ok;
Dl_info info;
if (!cls) return NULL;
ok = dladdr(cls, &info);
if (ok) return info.dli_fname;
else return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment