- make it compile on non-win32 platforms by stuffing all the DLL details
into macros. I got the idea for the MODULE1API(type) macros from expat.h that happens to be sitting on my disk. - modified: test2-dynamic/module1.cc test2-dynamic/module1.h test3-twomodules/module1.cc test3-twomodules/module1.h test3-twomodules/module2.cc test3-twomodules/module2.h test4-interdep/module1.cc test4-interdep/module1.h test4-interdep/module2.cc test4-interdep/module2.h
This commit is contained in:
parent
059b59c98e
commit
7f9c1489df
@ -1,4 +1,10 @@
|
||||
#define DLLINTERFACE __declspec(dllexport)
|
||||
// set up MODULE1API macro for DLL export
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE1API(type) __declspec(dllexport) type __cdecl
|
||||
#else
|
||||
# define MODULE1API(type) type
|
||||
#endif
|
||||
|
||||
#include "module1.h"
|
||||
|
||||
const char *module_name = "AddModule";
|
||||
|
@ -1,6 +1,10 @@
|
||||
#ifndef DLLINTERFACE
|
||||
#define DLLINTERFACE __declspec(dllimport)
|
||||
#ifndef MODULE1API
|
||||
# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE1API(type) __declspec(dllimport) type __cdecl
|
||||
# else
|
||||
# define MODULE1API(type) type
|
||||
# endif
|
||||
#endif
|
||||
|
||||
DLLINTERFACE extern const char * module_name;
|
||||
DLLINTERFACE extern int operate (int a, int b);
|
||||
MODULE1API(extern const char *) module_name;
|
||||
MODULE1API(extern int) operate (int a, int b);
|
||||
|
@ -1,6 +1,11 @@
|
||||
#define DLLINTERFACE __declspec(dllexport)
|
||||
// set up MODULE1API macro for DLL export
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE1API(type) __declspec(dllexport) type __cdecl
|
||||
#else
|
||||
# define MODULE1API(type) type
|
||||
#endif
|
||||
|
||||
#include "module1.h"
|
||||
#undef DLLINTERFACE
|
||||
#include "module2.h"
|
||||
|
||||
const char *module_name = "AddModule";
|
||||
|
@ -1,7 +1,11 @@
|
||||
#ifndef DLLINTERFACE
|
||||
#define DLLINTERFACE __declspec(dllimport)
|
||||
#ifndef MODULE1API
|
||||
# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE1API(type) __declspec(dllimport) type __cdecl
|
||||
# else
|
||||
# define MODULE1API(type) type
|
||||
# endif
|
||||
#endif
|
||||
|
||||
DLLINTERFACE extern const char * module_name;
|
||||
DLLINTERFACE extern int operate (int a, int b);
|
||||
MODULE1API(extern const char *) module_name;
|
||||
MODULE1API(extern int) operate (int a, int b);
|
||||
|
||||
|
@ -1,8 +1,12 @@
|
||||
#include <stdio.h>
|
||||
// set up MODULE2API macro for DLL export
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE2API(type) __declspec(dllexport) type __cdecl
|
||||
#else
|
||||
# define MODULE2API(type) type
|
||||
#endif
|
||||
|
||||
#define DLLINTERFACE __declspec(dllexport)
|
||||
#include <stdio.h>
|
||||
#include "module2.h"
|
||||
#undef DLLINTERFACE
|
||||
|
||||
int n_operations = 0;
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
#ifndef DLLINTERFACE
|
||||
#define DLLINTERFACE __declspec(dllimport)
|
||||
#ifndef MODULE2API
|
||||
# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE2API(type) __declspec(dllimport) type __cdecl
|
||||
# else
|
||||
# define MODULE2API(type) type
|
||||
# endif
|
||||
#endif
|
||||
|
||||
DLLINTERFACE extern int n_operations;
|
||||
DLLINTERFACE void operation_occurred ();
|
||||
MODULE2API(extern int) n_operations;
|
||||
MODULE2API(void) operation_occurred ();
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
#define DLLINTERFACE __declspec(dllexport)
|
||||
// set up MODULE1API macro for DLL export
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE1API(type) __declspec(dllexport) type __cdecl
|
||||
#else
|
||||
# define MODULE1API(type) type
|
||||
#endif
|
||||
|
||||
#include "module1.h"
|
||||
#undef DLLINTERFACE
|
||||
#include "module2.h"
|
||||
|
||||
const char *module_name = "AddModule";
|
||||
|
@ -1,7 +1,11 @@
|
||||
#ifndef DLLINTERFACE
|
||||
#define DLLINTERFACE __declspec(dllimport)
|
||||
#ifndef MODULE1API
|
||||
# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE1API(type) __declspec(dllimport) type __cdecl
|
||||
# else
|
||||
# define MODULE1API(type) type
|
||||
# endif
|
||||
#endif
|
||||
|
||||
DLLINTERFACE extern const char * module_name;
|
||||
DLLINTERFACE extern int operate (int a, int b);
|
||||
MODULE1API(extern const char *) module_name;
|
||||
MODULE1API(extern int) operate (int a, int b);
|
||||
|
||||
|
@ -1,8 +1,12 @@
|
||||
#include <stdio.h>
|
||||
// set up MODULE2API macro for DLL export
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE2API(type) __declspec(dllexport) type __cdecl
|
||||
#else
|
||||
# define MODULE2API(type) type
|
||||
#endif
|
||||
|
||||
#define DLLINTERFACE __declspec(dllexport)
|
||||
#include <stdio.h>
|
||||
#include "module2.h"
|
||||
#undef DLLINTERFACE
|
||||
|
||||
int n_operations = 0;
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
#ifndef DLLINTERFACE
|
||||
#define DLLINTERFACE __declspec(dllimport)
|
||||
#ifndef MODULE2API
|
||||
# if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
||||
# define MODULE2API(type) __declspec(dllimport) type __cdecl
|
||||
# else
|
||||
# define MODULE2API(type) type
|
||||
# endif
|
||||
#endif
|
||||
|
||||
DLLINTERFACE extern int n_operations;
|
||||
DLLINTERFACE void operation_occurred ();
|
||||
|
||||
MODULE2API(extern int) n_operations;
|
||||
MODULE2API(void) operation_occurred ();
|
||||
|
Loading…
Reference in New Issue
Block a user