work on dynamic libraries finished and ready for review
Lisandro Dalcin
dalcinl at gmail.com
Tue Oct 28 12:06:13 CDT 2008
I've finished some work on dynamic libraries. After a lot of
discussion with Barry, I've been conservative and I have not
introduced too much interface changes (basically, now
PetscDLLibraryOpen is in charge of allocating list entries). All the
relevant stuff is in 'petsc-dev-dalcinl' repo at 'src/sys/dll'
directory. Note the added 'dlimpl.h' and 'dlimpl.c', those files
abstract the platform-dependent details for windows/posix-like
systems, but those API's are not exposed to the end-user.
Some notes about things I'm still in doubt.
* Some valid URL-like prefixes for retrieving files are 'http://' and
'ftp://', Perhaps we could add support for 'ssh://', but I have no
idea of how to implement that. A thing that is a bit inconsistent is
that 'file:' is also special cased and accepted for dynamic libraries
in PetscDLLibraryRetrieve(), but note that perhaps it should be
'file://'. And perhaps the support for that prefix should be moved to
PetscFileRetrieve()
* When looking for symbols in Windows DLL's, there is a call to
GetCurrentProcess() for looking at the program symbol table. After
reading the docs at MSDN, I'm not sure if this actually works, I mean,
call GetProcAddress() with the handle returned by GetCurrentProcess().
* When PetscFinalize() is called, now dynamic libraries are actually
dlclose'd. But the dynlib list is traversed from the first entry to
the last. Perhaps this could cause problems in some rare cases, and we
should do a reversed traversal.
Finally, 'make testexamples' pass for PETSc compiled with static,
shared, or dynamic. So I'm confident that all this could be safely
pushed to petsc-dev if there are not objections.
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
More information about the petsc-dev
mailing list