_Z14readDatainMeshPdPiS0_S_PcS_S1_S0_S0_S0_S_S0_S0_S0_S_S_S_S0_S0_S0_S0_S_S_S_S_S0_S0_S_S0_S0_S_S1_S_S_S_S0_S_S_S_S0_S0_S0_S1_S1_S_S_
is the C++ mangled name including the parameter types. This way the C++ compiler can give overloaded functions different symbols and distinguish them.
One can demangle it from command line:
$ echo _Z14readDatainMeshPdPiS0_S_PcS_S1_S0_S0_S0_S_S0_S0_S0_S_S_S_S0_S0_S0_S0_S_S_S_S_S0_S0_S_S0_S0_S_S1_S_S_S_S0_S_S_S_S0_S0_S0_S1_S1_S_S_ | demangle
readDatainMesh(double*, int*, int*, double*, char*, double*, char*, int*, int*, int*, double*, int*, int*, int*, double*, double*, double*, int*, int*, int*, int*, double*, double*, double*, double*, int*, int*, double*, int*, int*, double*, char*, double*, double*, double*, int*, double*, double*, double*, int*, int*, int*, char*, char*, double*, double*)
You therefore have to tell the C++ compiler to treat this as C function without overloading. This can be done using extern "C"
. If the same header is used from C and C++code you also need a guard, as extern "C"
is not valid in C.
in full the header might look like this:
#ifndef READNAMELISTS_H
#define READNAMELISTS_H
#ifdef __cplusplus
extern "C" {
#endif
void readDatainMesh(...);
#ifdef __cplusplus
}
#endif
#endif
In case you do C++ only and that's the only function you can shorten it to
#ifndef READNAMELISTS_H
#define READNAMELISTS_H
extern "C" void readDatainMesh(...);
#endif