25.4.1 DLL Support with GNU Autotools
Here are the contents of the three source files used as an example for
the remainder of this chapter (for brevity, they are missing most of the
special code one would normally use to maximise portability):
`hello.h' documents the interface to `libhello.dll':
|
#ifndef HELLO_H
#define HELLO_H 1
extern int hello (const char *who);
#endif /* !HELLO_H */
|
`hello.c' is the implementation of `libhello.dll':
|
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include "hello.h"
int
hello (const char *who)
{
printf("Hello, %s!\n", who);
return 0;
}
|
`main.c' is the source for the executable which uses
`libhello.dll':
|
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "hello.h"
int
main (int argc, const char *const argv[])
{
return hello("World");
}
|
|