由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - c++ 两个库接口冲突
相关主题
不用头文件,如何调用函数?C++c function 在 c里调用和C++调用结果不一样
问问Boost library, 尤其是Boost Graph Library (BGL)在 linux下有没有可能得到完全的fully static binary
Can LGPL, Boost library be used in commercial software developing?What happens when recursion functions are declared inline?
function declaration问一个问题,面试被问倒了
computer graphics/vision 领域用哪种语言最多?pointer to function
请教c++里函数调用的问题what kind of reason might cause this problem?
C++ library for REST问个dynamic link library相关问题
关于inline function里的static variableinline function是否可以递归?
相关话题的讨论汇总
话题: functions话题: those话题: library话题: funcitons话题: make
进入Programming版参与讨论
1 (共1页)
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.

1 (共1页)
进入Programming版参与讨论
相关主题
inline function是否可以递归?computer graphics/vision 领域用哪种语言最多?
C++ Q96: function inheritance (转载)请教c++里函数调用的问题
Linux loading dynamic library problemC++ library for REST
问一个link的问题关于inline function里的static variable
不用头文件,如何调用函数?C++c function 在 c里调用和C++调用结果不一样
问问Boost library, 尤其是Boost Graph Library (BGL)在 linux下有没有可能得到完全的fully static binary
Can LGPL, Boost library be used in commercial software developing?What happens when recursion functions are declared inline?
function declaration问一个问题,面试被问倒了
相关话题的讨论汇总
话题: functions话题: those话题: library话题: funcitons话题: make