ibv_modify_qp 함수에는 서로 다른 버전의 라이브러리에 대해 두 가지 다른 서명이 있습니다. 두 라이브러리는 동일한 위치에 헤더 파일을 설치합니다. 아래는 2 가지 버전입니다.automake를 사용하여 함수의 프로토 타입이 다른 경우 C에서 조건부 컴파일
int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
int attr_mask);
int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
enum ibv_qp_attr_mask attr_mask);
내 라이브러리에서 드라이버 관련 함수의 포인터를 ibv_context_ops 구조체에 전달하고 있습니다.
/*ibv_context_ops field contains function pointers to driver specific functions*/
static struct ibv_context_ops c4iw_ctx_ops = {
.modify_qp = c4iw_modify_qp,
}
int c4iw_modify_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
int attr_mask);
그래서 프로토 타입은 내가 어떤 경고가 표시되지 일치하지만 프로토 타입이 다른 경우, 경고가 생성 될 때. 지금 나는 아래와 같이 CFLAGS를 사용하여 조건부로 컴파일하고있다.
#ifdef IBV_VER2
int c4iw_modify_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
int attr_mask);
#else
int c4iw_modify_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
enum ibv_qp_attr_mask attr_mask);
#endif
어쨌든 내가 함수 프로토 타입 라이브러리 헤더 파일에 정의 된 함수 프로토 타입을 기반으로 대체 함수 인자를 확인하기 위해 GNU automake에 사용이 할 수입니다.