-
Notifications
You must be signed in to change notification settings - Fork 20
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
Opir/Futhark fails to import code that uses __int128
#32
Comments
Well importing typedef struct WasmEdge_Value {
uint128_t Value;
enum WasmEdge_ValType Type;
} WasmEdge_Value;
The following type definitions resolve the issue. type
uInt128t* {.importc: "unsigned __int128".} = object
do_not_use1, do_not_use2: uint64
int128t* {.importc: "__int128".} = object
do_not_use1, do_not_use2: uint64 |
Hmm, this is a bit weird. So the |
That does indeed seem to be the issue. The following test C code: #include <stdint.h>
#include <stdio.h>
typedef struct {
int64_t a;
int64_t b;
} fake;
typedef struct {
__int128 f1;
int64_t f2;
} withreal;
typedef struct {
fake f1;
int64_t f2;
} withfake;
int main() {
printf("__int128 %d\n", sizeof(__int128));
printf("struct %d\n", sizeof(fake));
printf("withreal %d\n", sizeof(withreal));
printf("withfake %d\n", sizeof(withfake));
} outputs this:
Not entirely sure how to fix that, or if it is even fixable in a trivial way. But as you say Futhark allows you to define you own type definitions for edge cases like this. |
Attempting to wrap wasmedge for instance fails due to hitting
__int128
. The following is what I'm using if it helps. In this API one does not directly touch the data at__int128
so any allocation that matches the size should result in usable code.The text was updated successfully, but these errors were encountered: