Programming and posix - February 2001
February 10, 2001
Solution Symposium
Page 21
hp e3000
programming
and posix
creating an nmrl archive library - 2
• Have our main program in hwcgimain.c call an external:
#include <stdio.h>
extern void helloworld(void);
main()
{
printf("Content-type: text/plain\n\n");
helloworld();
}
shell/iX> gcc -c -D_POSIX_SOURCE hwcgimain.c
• Link the program:
shell/iX> gcc -o hwcgi hwcgimain.o -L. -lhw
or
shell/iX> ld -o hwcgi hwcgimain.o -L. -lhw
• -L. specifies library search directory (. is CWD)
• -lhw refers to libhw.a