Jeffrey D. Pursel wrote:
> Hello all,
>
>
>
> We would like to allow the users of one of our programs to substitute
> their own routines for particular components of our software.
> Additionally, we would like the user to accomplish this without having
> to recompile/link our code. To enable this functionality, we are
> considering the use of dynamically shared objects (DSOs). In the
> pseudocode below, we would compile sub1 and the main program; sub2 would
> be compiled and placed into a DSO that a user could replace with their
> own library. The target platforms are Cray X1s and other HPCs running
> flavors of unix.
>
>
>
> program main
>
> call sub1
>
> call sub2 ! contained in dso, may be replaced by user
>
> end program
>
>
>
>
>
> I would like to here the group’s thoughts on this approach and the
> questions below.
>
> Is there a better or standard approach to this problem?
This is a usual method to accomplish such a goal. I don't recognize a
specific system in your description.
>
> If the call to sub2 is within a performance critical loop, is the DSO
> loaded for each iteration? If so, is this a large overhead penalty?
>
Normally, if you have enough memory installed, that should not be a concern.
The usual source of additional overhead for shared library function
calls is associated with indirection in the calling sequence, and
possibly local data arrays, for position independent code. On certain
platforms, it may amount to as much as 5% even though the calls are not
too frequent.
>
> As an additional enhancement, is it possible to assign the name of sub2
> at runtime?
>
I assume this is answered multiple times in other replies.
|