DISCLAIMER: This site is a mirror of original one that was once available at http://iki.fi/~tuomov/b/

I'm trying to demonstrate here that the LGPL should to some extent be unnecessary. First, I'll provide the following code:
 * This code is in the public domain. 

#include <stdio.h>

static char tmp[1024];

char *readline(const char *s)
    printf("%s", s);
    fgets(tmp, 1024, stdin);
    return tmp;
It should be compiled with gcc -shared libreadline.c -o libreadline.so.5 and installed in /lib/ at your own risk.

My main program is the following:

 * Copyright (c) Tuomo Valkonen.
 * No derivative works may be created of this code.
 * Most specifically this code is _not_ under the GPL.

#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

int main(void)
    char *(*rl)(const char *prompt);
    char *res;
    void *h=dlopen("/lib/libreadline.so.5", RTLD_LAZY);
        fprintf(stderr, "Could not open libreadline: %s\n", 
        return EXIT_FAILURE;
    rl=dlsym(h, "readline");
        fprintf(stderr, "readline function not found\n");
        return EXIT_FAILURE;
    res=rl("> ");
    printf("Result: %s\n", res);
    return EXIT_SUCCESS;
My intent is for this program to be used with the libreadline I provided above, and it is this libreadline that this program refers to. Nowhere in this code do I specifically refer to GPL'd code. Thus by common sense I should not violate the GPL. Yet, if the user happens to not install my libreadline, and has the GPL'd GNU libreadline as /lib/libreadline.so.5, this program will work with it. Therefore, I have a program here that does not violate the GPL, yet is not under the GPL and can use a GPL'd library. But this is something that LGPL is supposed to exist for.

Update: It is possible devise a number of variations of this legal hack, some of which may even better avoid the intent trap and that do not require breaking the system by installing a semi-functional libreadline replacement. One obvious example is to allow overriding the location of the library with an environment variable, and defaulting to some safe path where the provided dummy library is installed. Another possibility that does not even require dynamic loading of the dummy library is for the user to override symbols with LD_PRELOAD.