GNet for developers

Compiling programs with GNet
Tips and tricks
Hiding blocking

Compiling programs with GNet

If you are a developer and you want to use GNet in your program, you can use the pkg-config script to figure out which flags need to set when compiling. For example, type gcc main.c `pkg-config --cflags --libs gnet-2.0` to compile the program main.c with GNet and link it to GNet. Note that those are backticks, not apostrophes.

If you use autoconf and automake, you can the pkg-config macros to set the appropriate variables. Just add this to your configure.in:

PKG_CHECK_MODULES(GNET, gnet-2.0 > 2.0.0,
  [LIBS="$LIBS $GNET_LIBS" CFLAGS="$CFLAGS $GNET_CFLAGS"],
  AC_MSG_ERROR(Cannot find GNet: do you have the GNet development packages installed?))