- eliminate duplicat symbols across modules

- modified: test9/module* test11/module* test12/module*
This commit is contained in:
Bryce Denney 2002-10-17 05:53:50 +00:00
parent 21695a8b18
commit b55ebd6130
9 changed files with 40 additions and 3 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

@ -2,6 +2,7 @@
#include <string.h>
#include <assert.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);

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

@ -2,6 +2,7 @@
#include <string.h>
#include <assert.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);

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include "main.h"
#define _buildsym(sym) libmodule1_LTX_##sym
#include "modules.h"
class ModuleGadget* module_init ()

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include "main.h"
#define _buildsym(sym) libmodule2_LTX_##sym
#include "modules.h"
int n_operations = 0;

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 ModuleGadget * module_init ();
int operate (int a, int b);
};
#endif
typedef class ModuleGadget* (*modload_func)(void);
@ -14,3 +24,4 @@ public:
virtual const char* getName ();
virtual const char* getFeatures ();
};