From the GNU GPL FAQ:
Can I apply the GPL when writing a
plug-in for a non-free program?
If the program uses fork and exec to
invoke plug-ins, then the plug-ins are
separate programs, so the license for
the main program makes no requirements
for them. So you can use the GPL for a
plug-in, and there are no special
requirements.
If the program dynamically links
plug-ins, and they make function calls
to each other and share data
structures, we believe they form a
single program, which must be treated
as an extension of both the main
program and the plug-ins. This means
that combination of the GPL-covered
plug-in with the non-free main program
would violate the GPL. However, you
can resolve that legal problem by
adding an exception to your plug-in's
license, giving permission to link it
with the non-free main program.
See also the question I am writing
free software that uses a non-free
library.
And:
What legal issues come up if I use
GPL-incompatible libraries with GPL
software?
Both versions of the GPL have an
exception to their copyleft, commonly
called the system library exception.
If the GPL-incompatible libraries you
want to use meet the criteria for a
system library, then you don't have to
do anything special to use them; the
requirement to distribute source code
for the whole program does not include
those libraries, even if you
distribute a linked executable
containing them.
The criteria for what counts as a
"system library" vary between
different versions of the GPL. GPLv3
explicitly defines "System Libraries"
in section 1, to exclude it from the
definition of "Corresponding Source."
GPLv2 says the following, near the end
of section 3:
However, as a special exception, the
source code distributed need not
include anything that is normally
distributed (in either source or
binary form) with the major components
(compiler, kernel, and so on) of the
operating system on which the
executable runs, unless that component
itself accompanies the executable.
...