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

  • fonts on linux

    I wrote a document on how to diagnose font problems on Linux. I would appreciate feedback, corrections, other common misconfigurations, etc.

  • socks5 proxying flash via ssh

    Suppose you're in Germany and want to watch some Flash-based videos that are IP-limited to the US for whatever reason. At first you'd think you could…

  • chromium.el

    This weekend I wrote some Emacs Lisp to write some utility functions I find useful for hacking on Chromium. It's fun to have a reason to use Lisp!…

  • 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