2002-10-16 17:28:17 +04:00
|
|
|
#if defined(WIN32) || defined(__CYGWIN__)
|
|
|
|
# ifdef MAIN_DLL_EXPORT
|
|
|
|
# ifdef DLL_EXPORT
|
|
|
|
# warning I will export DLL symbols for MODULE1
|
2002-10-17 02:33:32 +04:00
|
|
|
# define MAINAPI __declspec(dllexport)
|
2002-10-16 17:28:17 +04:00
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# warning I will import DLL symbols for MODULE1
|
2002-10-17 02:33:32 +04:00
|
|
|
# define MAINAPI __declspec(dllimport)
|
2002-10-16 17:28:17 +04:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifndef MAINAPI
|
|
|
|
# warning No DLL import/export is needed
|
2002-10-17 02:33:32 +04:00
|
|
|
# define MAINAPI
|
2002-10-16 17:28:17 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef void (*modload_func)(void);
|
|
|
|
|
2002-10-17 02:33:32 +04:00
|
|
|
MAINAPI extern const char * version_string;
|
|
|
|
MAINAPI extern int register_module (const char *name);
|
2002-10-16 17:28:17 +04:00
|
|
|
|
|
|
|
// really, this should only be included in the modules. It would be
|
|
|
|
// incorrect to call module_init from main, even if the compiler allowed
|
|
|
|
// you to.
|
|
|
|
extern "C" {
|
|
|
|
// this prevents C++ name mangling
|
|
|
|
void module_init ();
|
|
|
|
};
|
|
|
|
|
2002-10-17 02:33:32 +04:00
|
|
|
class MAINAPI Widget {
|
2002-10-16 17:28:17 +04:00
|
|
|
int id;
|
|
|
|
const char *name;
|
|
|
|
float weight;
|
|
|
|
public:
|
|
|
|
Widget(int id, const char* name, float weight);
|
|
|
|
int getId ();
|
|
|
|
const char* getName ();
|
|
|
|
float getWeight ();
|
|
|
|
void print (FILE*);
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_WIDGETS 10
|
2002-10-17 02:33:32 +04:00
|
|
|
MAINAPI extern Widget* widgets[MAX_WIDGETS];
|