- eliminate duplicate symbols between modules

This commit is contained in:
Bryce Denney 2002-10-17 05:49:20 +00:00
parent d36c9f2643
commit 21695a8b18
3 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include "main.h"
#define _buildsym(sym) libmodule1_LTX_##sym
#include "modules.h"
class CellPhone : public DeviceInterface {

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <string.h>
#include "main.h"
#define _buildsym(sym) libmodule2_LTX_##sym
#include "modules.h"
class GPS_Receiver : public DeviceInterface {

View File

@ -1,7 +1,17 @@
#ifdef _buildsym
// This section is included by each module to rename all of its symbols,
// in order to avoid duplicate symbols in different modules. From the
// libtool docs: "Although some platforms support having the same symbols
// defined more than once it is generally not portable."
#define module_init _buildsym(module_init)
#define operate _buildsym(operate)
extern "C" {
// this prevents C++ name mangling
// the extern "C" prevents C++ name mangling
class DeviceInterface * module_init ();
int operate (int a, int b);
};
#endif
typedef class DeviceInterface* (*modload_func)(void);