I thought I read about a C standard library function recently that was able to return a pointer to any extern variable whose name was passed to it as a const char *. I think that it works via linker symbols, if that helps.
+2
A:
You could be thinking of dlsym
, which is not part of the C standard library but part of the POSIX API.
dreamlax
2010-08-27 05:11:09
Yup, this looks like it. My mistake in thinking it was a C standard thing, POSIX is pretty close ;)
Jared P
2010-08-27 19:57:46
+2
A:
It depends on the system. dlsym
has already been mentioned. Its Windows counterpart is GetProcAddress
. In the latter case, the function needs to be not only external but exported.
Jerry Coffin
2010-08-27 05:15:28