Michael Jones (mtj++at++isdn-celeste.corp.sgi.com)
Tue, 7 May 1996 20:19:07 -0700
No.
| If so, couldn't this have been done in libpfdu.a, in the first place?
Well, take a look at the source code shipped in pfdLoadFile.c:
/* is the loader for this file type linked into the executable ? */
cDSO = &DSO[PF_MIN2(nDSOs, MAX_DSO_COUNT-1)];
cDSO->dso = dlopen(NULL, RTLD_LAZY);
if (cDSO->dso != NULL)
{
cDSO->initConverter = (initFunc) dlsym(cDSO->dso, initFuncName);
cDSO->loadFile = (loadFunc) dlsym(cDSO->dso, loadFuncName);
cDSO->storeFile = (storeFunc) dlsym(cDSO->dso, storeFuncName);
cDSO->convertTo = (convertToFunc) dlsym(cDSO->dso, convertToFuncName);
cDSO->convertFrom = (convertFromFunc) dlsym(cDSO->dso, convertFromFuncName);
cDSO->setMode = (setConverterModeFunc) dlsym(cDSO->dso, setConverterModeFuncName);
cDSO->getMode = (getConverterModeFunc) dlsym(cDSO->dso, getConverterModeFuncName);
cDSO->setAttr = (setConverterAttrFunc) dlsym(cDSO->dso, setConverterAttrFuncName);
cDSO->getAttr = (getConverterAttrFunc) dlsym(cDSO->dso, getConverterAttrFuncName);
cDSO->setVal = (setConverterValFunc) dlsym(cDSO->dso, setConverterValFuncName);
cDSO->getVal = (getConverterValFunc) dlsym(cDSO->dso, getConverterValFuncName);
if (cDSO->initConverter != NULL)
{
(*cDSO->initConverter)();
}
if (cDSO->loadFile != NULL)
{
cDSO->name = strdup(ext);
return cDSO;
}
}
What's happening is that the NULL argument to dlopen() means open the
current executable and the the dlsym() calls look for the functions
in the executable. If you linked it in, then it will be found and
remembered.
Michael Jones
Be seeing you, Phone:415.390.1455 Fax:415.965.2658 M/S:8U-590
Michael T. Jones Silicon Graphics, Advanced Graphics Division
mtj++at++sgi.com 2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311
"Competition is a by-product of productive work, not its goal. A
creative man is motivated by the desire to achieve, not by the desire
to beat others." -Ayn Rand
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:52 PDT