Mercurial > pub > dyncall > dyncall
comparison dynload/dynload_unix.c @ 552:61c485f8cc06
cosmetics & c-comments for consistency
author | Tassilo Philipp |
---|---|
date | Mon, 20 Jun 2022 15:11:52 +0200 |
parents | e221473a8217 |
children | 6a8aac9b2bcf |
comparison
equal
deleted
inserted
replaced
551:eef302b7a58d | 552:61c485f8cc06 |
---|---|
51 #include <dlfcn.h> | 51 #include <dlfcn.h> |
52 | 52 |
53 | 53 |
54 DLLib* dlLoadLibrary(const char* libPath) | 54 DLLib* dlLoadLibrary(const char* libPath) |
55 { | 55 { |
56 return (DLLib*)dlopen(libPath, RTLD_NOW|RTLD_GLOBAL); //@@@ should use RTLD_LAZY, maybe? | 56 return (DLLib*)dlopen(libPath, RTLD_NOW|RTLD_GLOBAL); /*@@@ should use RTLD_LAZY, maybe?*/ |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 void* dlFindSymbol(DLLib* pLib, const char* pSymbolName) | 60 void* dlFindSymbol(DLLib* pLib, const char* pSymbolName) |
61 { | 61 { |
127 uint32_t i; | 127 uint32_t i; |
128 int l = -1; | 128 int l = -1; |
129 | 129 |
130 /* request info about own process? lookup first loaded image */ | 130 /* request info about own process? lookup first loaded image */ |
131 if(pLib == NULL) { | 131 if(pLib == NULL) { |
132 const char* libPath = _dyld_get_image_name(0); //@@@ consider using _NSGetExecutablePath() | 132 const char* libPath = _dyld_get_image_name(0); /*@@@ consider using _NSGetExecutablePath()*/ |
133 if(libPath) | 133 if(libPath) |
134 l = dl_strlen_strcpy(sOut, libPath, bufSize); | 134 l = dl_strlen_strcpy(sOut, libPath, bufSize); |
135 } | 135 } |
136 else { | 136 else { |
137 /* Darwin's code doesn't come with (non-standard) dlinfo(), so use dyld(1) | 137 /* Darwin's code doesn't come with (non-standard) dlinfo(), so use dyld(1) |