- eliminate duplicate symbols between modules
This commit is contained in:
parent
d36c9f2643
commit
21695a8b18
@ -1,5 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#define _buildsym(sym) libmodule1_LTX_##sym
|
||||
#include "modules.h"
|
||||
|
||||
class CellPhone : public DeviceInterface {
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user