c-for-go
c-for-go copied to clipboard
[Help] Coolprop
I am trying to wrap CoolProp. I am a newbie in go, coolprop and c-for-go, so what can go wrong? ;oP
I am trying the following:
---
GENERATOR:
PackageName: coolprop
PackageDescription: "Package nidaqmx provides Go bindings for CoolProp"
PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
Includes:
- CoolProp.h
PARSER:
IncludePaths:
- ../../include
SourcesPaths:
- CoolPropLib.h
TRANSLATOR:
ConstRules:
defines: expand
Rules:
global:
- {action:accept, from: "Props1SI"}
I am getting the following error:
[jose@mountain Golang]$ c-for-go coolprop-go.yml
processing coolprop-go.yml ⠋[ERR] ../../include/CoolPropLib.h:142:78: unexpected identifier val, expected one of ['(', ')', ',', ':', ';', '=', '[', '{', _Bool, _Complex, _Noreturn, _Static_assert, asm, auto, char, const, double, enum, extern, float, inline, int, long, register, restrict, short, signed, static, struct, typedef, typedefname, typeof, union, unsigned, void, volatile]
so it complains about line 142.
Any idea about what am I doing wrong?
Hi! Try to define COOLPROP_LIB otherwise there will be no extern "C" in the headers.
https://github.com/xlab/c-for-go/wiki/Parser-config-section#defines
With:
Defines:
COOLPROP_LIB: 1
I get the error:
processing coolprop-go.yml ⠋[ERR] ../../include/CoolPropLib.h:84:5: unexpected string literal "C", expected one of ['(', ')', '*', ',', ';', '[', _Bool, _Complex, _Noreturn, auto, char, const, double, enum, extern, float, identifier, inline, int, long, register, restrict, short, signed, static, struct, typedef, typedefname, typeof, union, unsigned, void, volatile]
So it fails here:
EXPORT_CODE double CONVENTION Props1SI(const char *FluidName, const char* Output);
I assume that EXPORT_CODE contains extern "C".
Any clue?