1 |
|
/* foo.h -- interface to the libfoo library |
2 |
|
Copyright (C) 1996-1999 Free Software Foundation, Inc. |
3 |
|
Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
4 |
|
This file is part of GNU Libtool. |
5 |
|
|
6 |
|
This program is free software; you can redistribute it and/or modify |
7 |
|
it under the terms of the GNU General Public License as published by |
8 |
|
the Free Software Foundation; either version 2 of the License, or |
9 |
|
(at your option) any later version. |
10 |
|
|
11 |
|
This program is distributed in the hope that it will be useful, |
12 |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
GNU General Public License for more details. |
15 |
|
|
16 |
|
You should have received a copy of the GNU General Public License |
17 |
|
along with this program; if not, write to the Free Software |
18 |
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
USA. */ |
20 |
|
|
21 |
|
/* Only include this header file once. */ |
22 |
|
#ifndef _FOO_H_ |
23 |
|
#define _FOO_H_ 1 |
24 |
|
|
25 |
|
/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and |
26 |
|
* earlier do not define __CYGWIN__. This snippit allows us to check |
27 |
|
* for __CYGWIN32__ reliably for both old and (probable) future releases. |
28 |
|
*/ |
29 |
|
#ifdef __CYGWIN__ |
30 |
|
# ifndef __CYGWIN32__ |
31 |
|
# define __CYGWIN32__ |
32 |
|
# endif |
33 |
|
#endif |
34 |
|
|
35 |
|
/* __BEGIN_DECLS should be used at the beginning of your declarations, |
36 |
|
so that C++ compilers don't mangle their names. Use __END_DECLS at |
37 |
|
the end of C declarations. */ |
38 |
|
#undef __BEGIN_DECLS |
39 |
|
#undef __END_DECLS |
40 |
|
#ifdef __cplusplus |
41 |
|
# define __BEGIN_DECLS extern "C" { |
42 |
|
# define __END_DECLS } |
43 |
|
#else |
44 |
|
# define __BEGIN_DECLS /* empty */ |
45 |
|
# define __END_DECLS /* empty */ |
46 |
|
#endif |
47 |
|
|
48 |
|
/* LTDL_PARAMS is a macro used to wrap function prototypes, so that compilers |
49 |
|
that don't understand ANSI C prototypes still work, and ANSI C |
50 |
|
compilers can issue warnings about type mismatches. */ |
51 |
|
#undef LTDL_PARAMS |
52 |
|
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN32__) || defined(__cplusplus) |
53 |
|
# define LT_PARAMS(protos) protos |
54 |
|
# define lt_ptr_t void* |
55 |
|
#else |
56 |
|
# define LT_PARAMS(protos) () |
57 |
|
# define lt_ptr_t char* |
58 |
|
#endif |
59 |
|
|
60 |
|
#ifdef __CYGWIN32__ |
61 |
|
# ifdef LIBFOO_DLL |
62 |
|
/* need some (as yet non-existant) automake magic to tell |
63 |
|
* the object whether the libfoo it will be linked with is |
64 |
|
* a dll or not, ie whether LIBFOO_DLL is defined or not. |
65 |
|
*/ |
66 |
|
# ifdef _LIBFOO_COMPILATION_ |
67 |
|
# define EXTERN __declspec(dllexport) |
68 |
|
# else |
69 |
|
# define EXTERN extern __declspec(dllimport) |
70 |
|
# endif |
71 |
|
# else |
72 |
|
# define EXTERN extern |
73 |
|
# endif |
74 |
|
#else |
75 |
|
# define EXTERN extern |
76 |
|
#endif |
77 |
|
|
78 |
|
/* Silly constants that the functions return. */ |
79 |
|
#define HELLO_RET 0xe110 |
80 |
|
#define FOO_RET 0xf00 |
81 |
|
|
82 |
|
|
83 |
|
/* Declarations. Note the wonderful use of the above macros. */ |
84 |
|
__BEGIN_DECLS |
85 |
|
int foo LT_PARAMS((void)); |
86 |
|
int hello LT_PARAMS((void)); |
87 |
|
EXTERN int nothing; |
88 |
|
__END_DECLS |
89 |
|
|
90 |
|
#endif /* !_FOO_H_ */ |