Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

weak-linking

More demands for weak linking.
I'm thinking this could be made into a utility and set of associated autoconf scripts. I want to be able to say in some central place "I want to weak-link against libfoo.so" and have it generate headers like this:
#ifdef LINK_WITH_LIBFOO

#define weaklink_libfoo_init() 1

#elif defined(WEAKLINK_WITH_LIBFOO)

/* generated from void foo_bar(int) */
extern void (*foo_bar)(int);  /* initialize it to NULL in the .c file. */

void weaklink_libfoo_init(void);
/* body of that function is {
  dlinit ...;
  foo_bar = dlsym ...;
} */

#else  /* they don't want to link with libfoo at all.  */

#error Don't include this header unless HAVE_LIBFOO is defined.

#endif
And then do the appropriate configure-time trickery.
Subscribe

  • memcache job offers

    I get occasional recruiter spam that specifically calls out "my work on memcached". This is pretty funny because all I did was make some trivial…

  • application stack

    "Put yourself in 1995. I'm going to tell the you of 1995 that in 2010, there will be a software platform with the following properties:" Luis Villa…

  • münchen

    On that note: I'm living in Munich for the next week plus a few days. Do I know anyone around here? (PS: The LJ → PubSubHubbub → Reader…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments