-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrectly converting C types to smaller sizes #120
Comments
You should try editing your /usr/local/include/stddef.h file or wherever that I did NOT have this issue in my conversion using my edited files, and it still crashed in #121 so there is something else going on.. |
Hi. I'm having a similar problem and while c-for-go recognizes that it is an func rsmi_init(Init_flags uint32) RSMI_status {
cInit_flags, cInit_flagsAllocMap := (C.uint64_t)(Init_flags), cgoAllocsUnknown
__ret := C.rsmi_init(cInit_flags)
runtime.KeepAlive(cInit_flagsAllocMap)
__v := (RSMI_status)(__ret)
return __v
} I tried to resolve #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
int main() {
uint64_t test = 0;
if (__builtin_types_compatible_p(typeof(test), unsigned)) {
printf("unsigned\n");
} else if (__builtin_types_compatible_p(typeof(test), unsigned long)) {
printf("unsigned long\n");
} else if (__builtin_types_compatible_p(typeof(test), unsigned long long)) {
printf("unsigned long long\n");
} else if (__builtin_types_compatible_p(typeof(test), unsigned long int)) {
printf("unsigned long int\n");
}
return 0;
} I replaced all occurrences of Any helpful advice? As a remark: I cannot edit system headers due to lack of privileges. Adding a separate header with just the |
Yep I had to use |
Also, looking at those model tables, it would seem that it is just not finding the right model somehow.. and @TomTheBear instead of editing system headers, you can add a -I include path to your own header that is only used in the c-for-go build process -- that is what I did.. |
My remark is related to this sentence part:
|
I'm seeing very different, and mostly better, results since the v4 merge a couple days ago. I suspect this ticket is fine to close. I've got new issues with duplicate declarations of types, so I can file another ticket on that if it's not already being worked on, but I think this is ok now. |
@nergdron I don't think this issue is solved... |
I've created #138 for the data type size problem also mentioned here |
ok, this is a weird one. using the latest
c-for-go
, andgo 1.18.1
, I'm getting types converted to smaller, inaccurate types from what is in the C headers. for instance, in/usr/include/vulkan/vulkan_core.h
, I have:but what
c-for-go
generates is:and the diff between this and the last generated version in
go-vulkan
repo shows it being changed fromuint64
touint32
, so this is definitely something that used to work. pretty much every instance I can find in the C code of 64-bit numbers are now converted to 32-bit versions, which obviously completely breaks. Any ideas why this is happening?The text was updated successfully, but these errors were encountered: