work on dynamic libraries finished and ready for review

Barry Smith bsmith at mcs.anl.gov
Tue Oct 28 14:43:56 CDT 2008


On Oct 28, 2008, at 12:06 PM, Lisandro Dalcin wrote:

> 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.
>

    I'm curious why you didn't go all the way and make it a full
PETSc object (like I suggested). Did you have technical reasons
or was it mostly just fear of breaking something? I'm in the mood
to have it be "right" for our release coming up soon.

> 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()

   I agree, it should handle file:// in the standard manner (I think
it is the way it is because it was a simple hack to get file: working.
>
>
> * 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().

   I have no idea.

>
>
> * 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.

  This sounds like it should be changed as you suggest.
>
>
>
> 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.

     I works on my Mac :-).

    Feel free to push over after the changes you suggested above.

    Barry
>
>
>
>
> -- 
> 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