Comments (7)
This seems like a C++ only header file to me. The extern "C" {
should be, for C compatibility, wrapped in
#ifdef __cplusplus
extern "C" {
#endif
See also: Combining C++ and C - how does #ifdef __cplusplus work?
from c-for-go.
Hi,
H file same as above.
Working on this again. Error was:
unexpected identifier set_work_dir, expected one of ['(', ')', ',', ':',
etc...
Changing
void DEX_API set_work_dir( const char *pName);
to (removing DEX_API)
void set_work_dir(const char *pName);
allows it to compile without error, but it's still an empty dexapi.go file.
yml is
---
GENERATOR:
PackageName: dexapi
PackageDescription: "Package dexapi provides Go bindings for Dex Tools 2.23 for IWR3 decode to DF3"
PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
Includes: ["DexApi.h"]
PARSER:
SourcesPaths: ["DexApi.h"]
Rules:
global:
- {action: accept, from: "^set_work_dir$"}
- {action: accept, from: "^make_strips$"}
- {action: accept, from: "^list_forward$"}
- {action: accept, from: "^list_phy_toc$"}
result dexapi.go is:
package dexapi
/*
#include "DexApi.h"
#include <stdlib.h>
#include "cgo_helpers.h"
*/
import "C"
from c-for-go.
That worked. Now I have:
processing dexapi.yml ⠋[ERR] DexApi.h:32:14: unexpected identifier set_work_dir
from c-for-go.
Moved #ifdef __cplusplus
to top of file and endif to bottom. Compiled.
.. basically an empty file. oops
from c-for-go.
@5k3105 Have you used this?
from c-for-go.
@5k3105 Also, everything is ignored by default, you should include functions and other types you want to use explicitly. Remember nidaqmx.yml
?
Rules:
global:
- {action: accept, from: "^DAQmx"}
- {action: replace, from: "^DAQmx"}
- {transform: export}
post-global:
- {action: replace, from: _$}
- {load: snakecase}
In this case you can't use prefixes, there is no prefixes, so specify exact function names and const definitions. E.g.
- {action: accept, from: "^make_strips$"}
- {action: accept, from: "^ list_forward$"}
- {action: accept, from: "^ list_phy_toc$"}
...
from c-for-go.
Sorry and thanks for the help.
Error:
processing dexapi.yml ⠋[ERR] DexApi.h:37:14: unexpected identifier set_work_dir, 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]
header:
// -*- C++ -*-
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//#define __cplusplus
#if !defined DexApi_h
# define DexApi_h
typedef enum { eStopped=0, eTransition=1, eRunning=2 }STATES_E;
typedef enum { no_error = 0,
not_ready = -1,
no_data = -2,
no_toc = -3
} ERRORS_E;
enum {
eMAX_API_VERSION=40
};
#define DEX_EXP __declspec(dllexport)
#define DEX_IMP __declspec(dllimport)
#define API_SOURCE 1 // 1 for DLL; 0 for application
#if API_SOURCE==1
#define DEX_API DEX_EXP
#else
#define DEX_API DEX_IMP
#endif
#ifdef __cplusplus
extern "C" {
#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DEX_API set_work_dir( const char *pName);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DEX_API set_batch_mode( int mode);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DEX_API set_bin_filename( const char *pName);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DEX_API set_project_name(const char *pName);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DEX_API get_dll_version(char *pName, int size);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API get_run_state();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API get_delayed_result();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API get_frame_count();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_EXP get_shot_rate();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API get_1pps_count();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API get_strip_count();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API copy_ssd();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API make_strips();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API make_strip( int choice);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API get_section_pkts(int first, int last);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API list_forward();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API make_df3();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int DEX_API list_phy_toc();
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DEX_API get_phy_info( int *pArray, int num_ints );
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DEX_EXP get_reader_progress( int *pArray, int num_ints );
#ifdef __cplusplus
}
#endif
#endif // DexApi.h
yaml:
---
GENERATOR:
PackageName: dexapi
PackageDescription: "Package dexapi provides Go bindings for Dex Tools 2.23 for IWR3 decode to DF3"
PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
Includes: ["DexApi.h"]
Defines:
DexApi_h: 1
PARSER:
SourcesPaths: ["DexApi.h"]
Rules:
global:
- {action: accept, from: "^set_work_dir$"}
- {action: accept, from: "^make_strips$"}
- {action: accept, from: "^list_forward$"}
- {action: accept, from: "^list_phy_toc$"}
from c-for-go.
Related Issues (20)
- How to handle a function returning a struct as value
- Type translation does not respect systems data model HOT 1
- Verbose argument to print more logs
- Avoid lock / unlock for some function call
- Wiki need to be updated
- panic: unknown type _Float128 HOT 2
- Non int return function pointer not recognized
- Generator uses underlying type of typedef when used as a parameter
- Website down HOT 3
- It would be nice to at least have an example of the YML required in the readme since the website does not work HOT 1
- build HOT 5
- [OS X / Ubuntu ARM64] include file not found: <string> HOT 3
- Extracting SAL annotations from declarations HOT 2
- Example where C const get translated into Go typed const
- Callback generation HOT 2
- THIS IS NOT AN ISSUE!!!
- Avoid symbol lookup error
- Passing in an array to a C function and reading the data - incorrect autogenerated Go code
- Write rules against the location of the type/define rather than the name
- Fails to parse vulkan_beta.h
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c-for-go.