History log of /libCEED/rust/libceed-sys/c-src/interface/ceed-register.c (Results 26 – 27 of 27)
Revision Date Author Comments
# 14b01f2c 16-Dec-2020 Jed Brown <jed@jedbrown.org>

Merge pull request #674 from CEED/jed/static-link

static link


# 1d013790 14-Dec-2020 Jed Brown <jed@jedbrown.org>

Add static library (libceed.a) [resolve #670]

We no longer use __attribute__((constructor)) to register backends and
gallery implementations because we can't ensure that the symbols are
linked into

Add static library (libceed.a) [resolve #670]

We no longer use __attribute__((constructor)) to register backends and
gallery implementations because we can't ensure that the symbols are
linked into applications that link the static library. We've switched to
creating CeedRegisterAll() and CeedQFunctionRegisterAll(), which are
called automatically by the library, and call weak symbols to register
all the backend/gallery implementations. This strategy was partly
motivated by not wanting to have preprocessor macros describing what is
available, and the associated need to recompile rather than just relink
when those macros change.

So we now have backends/ceed-backend-list.h that declares all the
backends wrapped in a macro. It is included by
backends/ceed-backend-weak.c to create weak definitions of all the
backends. In the makefile, we sort so this comes last when linking a
shared or static library, and thus these weak symbols will only be
picked up if they were not defined by the actual backend source files.
The same header is included (with different macro wrapping) in
interface/ceed-register.c, where CeedRegisterAll() is defined.

To add a new backend, one must do essentially the same registration
strategy as in the past, plus add one line to the common
ceed-backend-list.h.

show more ...


12