AssertionError: duplicated definitions should be exactly the same! #392
-
I try to use Clang.jl on a library named #ifndef HSL_MC69S_H
#define HSL_MC69S_H
/* Following #defines provide backwards compat to older interface version */
#ifndef mc69_verify
#define mc69_verify mc69_verify_s
#define mc69_print mc69_print_s
#define mc69_set_values mc69_set_values_s
#define mc69_cscl_clean mc69_cscl_clean_s
#define mc69_cscl_convert mc69_cscl_convert_s
#define mc69_cscu_convert mc69_cscu_convert_s
#define mc69_csclu_convert mc69_csclu_convert_s
#define mc69_csrl_convert mc69_csrl_convert_s
#define mc69_csru_convert mc69_csru_convert_s
#define mc69_csrlu_convert mc69_csrlu_convert_s
#define mc69_coord_convert mc69_coord_convert_s
#endif
typedef float mc69pkgtype_s_;
#ifndef HSL_MATRIX_TYPE
#define HSL_MATRIX_TYPE
typedef enum hsl_matrix_type {
/* Undefined or Unknown matrix */
HSL_MATRIX_UNDEFINED = 0,
/* Real matrices */
HSL_MATRIX_REAL_RECT = 1, /* real rectangular */
HSL_MATRIX_REAL_UNSYM = 2, /* real unsymmetric */
HSL_MATRIX_REAL_SYM_PSDEF = 3, /* real symmetric pos def */
HSL_MATRIX_REAL_SYM_INDEF = 4, /* real symmetric indef */
HSL_MATRIX_REAL_SKEW = 6, /* real skew symmetric */
/* Complex matrices */
HSL_MATRIX_CPLX_RECT = -1, /* complex rectangular */
HSL_MATRIX_CPLX_UNSYM = -2, /* complex unsymmetric */
HSL_MATRIX_CPLX_HERM_PSDEF= -3, /* hermitian pos def */
HSL_MATRIX_CPLX_HERM_INDEF= -4, /* hermitian indef */
HSL_MATRIX_CPLX_SYM = -5, /* complex symmetric */
HSL_MATRIX_CPLX_SKEW = -6 /* complex skew symmetric */
} hsl_matrix_type;
#endif
/* Verify is a matrix is in HSL standard form */
int mc69_verify_s(const int unit, const hsl_matrix_type type, const int findex,
const int m, const int n, const int ptr[], const int row[],
const mc69pkgtype_s_ val[], int *more);
.... #ifndef HSL_MC69D_H
#define HSL_MC69D_H
/* Following #defines provide backwards compat to older interface version */
#ifndef mc69_verify
#define mc69_verify mc69_verify_d
#define mc69_print mc69_print_d
#define mc69_set_values mc69_set_values_d
#define mc69_cscl_clean mc69_cscl_clean_d
#define mc69_cscl_convert mc69_cscl_convert_d
#define mc69_cscu_convert mc69_cscu_convert_d
#define mc69_csclu_convert mc69_csclu_convert_d
#define mc69_csrl_convert mc69_csrl_convert_d
#define mc69_csru_convert mc69_csru_convert_d
#define mc69_csrlu_convert mc69_csrlu_convert_d
#define mc69_coord_convert mc69_coord_convert_d
#endif
typedef double mc69pkgtype_d_;
#ifndef HSL_MATRIX_TYPE
#define HSL_MATRIX_TYPE
typedef enum hsl_matrix_type {
/* Undefined or Unknown matrix */
HSL_MATRIX_UNDEFINED = 0,
/* Real matrices */
HSL_MATRIX_REAL_RECT = 1, /* real rectangular */
HSL_MATRIX_REAL_UNSYM = 2, /* real unsymmetric */
HSL_MATRIX_REAL_SYM_PSDEF = 3, /* real symmetric pos def */
HSL_MATRIX_REAL_SYM_INDEF = 4, /* real symmetric indef */
HSL_MATRIX_REAL_SKEW = 6, /* real skew symmetric */
/* Complex matrices */
HSL_MATRIX_CPLX_RECT = -1, /* complex rectangular */
HSL_MATRIX_CPLX_UNSYM = -2, /* complex unsymmetric */
HSL_MATRIX_CPLX_HERM_PSDEF= -3, /* hermitian pos def */
HSL_MATRIX_CPLX_HERM_INDEF= -4, /* hermitian indef */
HSL_MATRIX_CPLX_SYM = -5, /* complex symmetric */
HSL_MATRIX_CPLX_SKEW = -6 /* complex skew symmetric */
} hsl_matrix_type;
#endif
/* Verify is a matrix is in HSL standard form */
int mc69_verify_d(const int unit, const hsl_matrix_type type, const int findex,
const int m, const int n, const int ptr[], const int row[],
const mc69pkgtype_d_ val[], int *more);
.... I generate the interface with the following options: [general]
use_julia_native_enum_type = false
print_using_CEnum = false
print_enum_as_integer = true
[codegen]
use_julia_bool = true
use_ccall_macro = true
always_NUL_terminated_string = true
[codegen.macro]
macro_mode = "disable" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
Do you want to merge all of the symbols in these headers into a single module? If not, you could create a new context for each header and generate 4 different Julia modules. Clang.jl will try to merge all identifiers(variable names) within one context. These headers contain definition collisions like:
so, it's impossible to generate valid code in a single Julia module. Julia doesn't allow us to define:
|
Beta Was this translation helpful? Give feedback.
Do you want to merge all of the symbols in these headers into a single module? If not, you could create a new context for each header and generate 4 different Julia modules.
Clang.jl will try to merge all identifiers(variable names) within one context. These headers contain definition collisions like:
so, it's impossible to generate valid code in a single Julia module. Julia doesn't allow us to define: