Comments (10)
I've added a pull request which fixes this issue.
from c-for-go.
I'm new to c-fo-go and I try to bring https://github.com/goonya/open62541-go up to date but I also see missing const definitions. surprisingly not all const/defines are missing but most.
maybe @lotodore has a clou as he's the author of c95ebd0
from c-for-go.
@lotodore we summon you :)
from c-for-go.
Thanks for testing the latest release! I'm really happy to receive some kind of feedback, as I wasn't sure whether everything is fine. The code I used to test migration to CCv4 only translates enums. I need to add one or more unit tests for defines, probably the CC tree changed with regards to defines. It may take a few days, however, as I'm really busy with a work project at the moment.
@yeahdongcn Is this related to the "replace" action from your configuration file or can the issue be reproduced just with the define without "replace"?
from c-for-go.
@lotodore Yes, enums translation works fine on my side too. I have tried to remove replace
and this issue is still reproducible.
BTW, I'm using the following code to pin to the latest version of c-for-go
and the config file hasn't been updated recently.
C_FOR_GO = $(shell pwd)/bin/c-for-go
.PHONY: c-for-go
c-for-go: ## Download c-for-go locally if necessary.
$(call go-install-tool,$(C_FOR_GO),github.com/xlab/c-for-go@latest)
# go-install-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-install-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
ended
from c-for-go.
Thanks for fixing this issue! Tested against the latest commit, the define
s are back.
One more change is introduced as follows. Do you think this should be considered as a new issue?
Source: abc.h
#ifndef ABC_H_
#define ABC_H_
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_MSC_VER)
#ifdef ABC_EXPORT
#define ABC_API __declspec(dllexport)
#else
#define ABC_API __declspec(dllimport)
#endif
#else
#define ABC_API __attribute__ ((visibility ("default")))
#endif
Generated: const.go
const (
// H_ as defined in include/abc.h
// API as defined in include/abc.h
API = 0x5edf60
...
)
from c-for-go.
At first sight, I'm not sure whether the new issue is a bug. If you believe it is, I'd suggest that you post it separately.
The parser has improved with the update, so it will catch all definitions. If you include these definitions in your rules, they will be exported. ABC_API is to be included according to your rules, so at first sight I would say you need to exclude it if you do not want that.
from c-for-go.
Sounds reasonable. Let me close this issue first.
from c-for-go.
Thinking more about it, one might be able to filter these kind of definitions by checking whether they are "pointers", because these pointers cannot be translated to const in any meaningful way. I cannot promise, but feel free to open a new issue :-)
from c-for-go.
Agree, previously it wouldn't work at all, so we'd filter somethinging like that on the spec level
from c-for-go.
Related Issues (20)
- define pointer to function HOT 1
- type C.struct_ in strut and func HOT 1
- 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
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.