i***h 发帖数: 12655 | 1 在用两个第三方 library,
可是里面头文件有相同的定义
所以不能直接同时包括两个库的头文件
我可以写adaptor, 似乎比较繁琐,
有更简洁的方案没?
谢谢 |
i***h 发帖数: 12655 | 2 可惜不能用namespace 区别 #include |
P********e 发帖数: 2610 | 3 第三方写的library没有自己的namespace???
什么定义冲突啊?
【在 i***h 的大作中提到】 : 在用两个第三方 library, : 可是里面头文件有相同的定义 : 所以不能直接同时包括两个库的头文件 : 我可以写adaptor, 似乎比较繁琐, : 有更简洁的方案没? : 谢谢
|
p****s 发帖数: 32405 | 4 大家都有#define foo ?
【在 P********e 的大作中提到】 : 第三方写的library没有自己的namespace??? : 什么定义冲突啊?
|
i***h 发帖数: 12655 | 5 对
【在 p****s 的大作中提到】 : 大家都有#define foo ?
|
i***h 发帖数: 12655 | 6 两边都是 c libaray
都有
#define foo
我们用c++
【在 P********e 的大作中提到】 : 第三方写的library没有自己的namespace??? : 什么定义冲突啊?
|
m****o 发帖数: 114 | 7 create a new header file to be included by your own code, where you can make
different names or namespaces for the funcitons or symbols from two library
, and create two seperate source files (one for each library) to implement those functions, which just are wrappers of those conflict funcitons.
【在 i***h 的大作中提到】 : 在用两个第三方 library, : 可是里面头文件有相同的定义 : 所以不能直接同时包括两个库的头文件 : 我可以写adaptor, 似乎比较繁琐, : 有更简洁的方案没? : 谢谢
|
i***h 发帖数: 12655 | 8 我就是这么干的
就是想问问有没有偷懒的办法
make
library
those
【在 m****o 的大作中提到】 : create a new header file to be included by your own code, where you can make : different names or namespaces for the funcitons or symbols from two library : , and create two seperate source files (one for each library) to implement those functions, which just are wrappers of those conflict funcitons.
|
P********e 发帖数: 2610 | 9 一个可能不够
每个libary一个wrapper
make
library
those functions, which just are wrappers of those conflict funcitons.
【在 m****o 的大作中提到】 : create a new header file to be included by your own code, where you can make : different names or namespaces for the funcitons or symbols from two library : , and create two seperate source files (one for each library) to implement those functions, which just are wrappers of those conflict funcitons.
|
m****o 发帖数: 114 | 10 that's what i meant: one for each...maybe i did not make it clear.....
【在 P********e 的大作中提到】 : 一个可能不够 : 每个libary一个wrapper : : make : library : those functions, which just are wrappers of those conflict funcitons.
|
m****o 发帖数: 114 | 11 it's just a couple lines of code
(you have many functions to be adapted?)
【在 i***h 的大作中提到】 : 我就是这么干的 : 就是想问问有没有偷懒的办法 : : make : library : those
|
i***h 发帖数: 12655 | 12 难道不是每个函数(即使不冲突)在wrap里都得再call一遍?
【在 m****o 的大作中提到】 : it's just a couple lines of code : (you have many functions to be adapted?)
|
m****o 发帖数: 114 | 13 i should take back my comments......maybe i should shut up.
two functions of the same signature cannot live within the same executable. since you cannot make changes to those lib files, so you will have to use dlXXXX functions to dynamically load each lib and use the functions.
【在 i***h 的大作中提到】 : 难道不是每个函数(即使不冲突)在wrap里都得再call一遍?
|
h***i 发帖数: 1970 | 14
可以把,取决于link时的顺序
executable. since you cannot make changes to those lib files, so you will
have to use dlXXXX functions to dynamically load each lib and use the
functions.
【在 m****o 的大作中提到】 : i should take back my comments......maybe i should shut up. : two functions of the same signature cannot live within the same executable. since you cannot make changes to those lib files, so you will have to use dlXXXX functions to dynamically load each lib and use the functions.
|