- eliminate duplicate symbol names in modules
This commit is contained in:
parent
0710552145
commit
d36c9f2643
@ -1,5 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#define _buildsym(sym) libmodule1_LTX_##sym
|
||||
#include "modules.h"
|
||||
|
||||
void module_init ()
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#define _buildsym(sym) libmodule2_LTX_##sym
|
||||
#include "modules.h"
|
||||
|
||||
int n_operations = 0;
|
||||
|
||||
|
17
bochs-testing/plugin-test/test8-execlass/modules.h
Normal file
17
bochs-testing/plugin-test/test8-execlass/modules.h
Normal file
@ -0,0 +1,17 @@
|
||||
// This file 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)
|
||||
|
||||
// Declare function prototypes in an extern "C" block so that C++ will not
|
||||
// mangle their names (any more than we already have).
|
||||
extern "C" {
|
||||
void module_init();
|
||||
int operate (int a, int b);
|
||||
};
|
||||
|
||||
// Since the renaming and extern "C" stuff declaration is done in the
|
||||
// header file, the actual code remains readable.
|
Loading…
x
Reference in New Issue
Block a user