[comp.sys.sun] "dlsym" issue

guy@uunet.uu.net (Guy Harris) (06/13/91)

>	myloadedfunc1 = dlsym(libhandle, "_func1");

BTW, if the name of the function that you're trying to get a pointer to is
"func1", pass "func1", *not* "_func1", to "dlsym()".

Both may *work* in SunOS 4.1; however, not *all* systems with "dlsym()"
have compilers that prepend underscores to symbol names, and I don't know
if the "dlsym()" on any of those System V Release 4 systems will be
"polite" enough to find "func1" if asked for "_func1".

I.e.,

	dlsym(libhandle, "func1")

should find the function whose name, in the C source code that defines
it, is "func1", both in SunOS 4.1 and System V Release 4; however, while

	dlsym(libhandle, "_func1")

will find it in SunOS 4.1, it may not find it in System V Release 4, so
the former, as it may work on more systems, is preferable to the latter.