#Can zig translate-c output cImport and cInclude instead of inlining headers?

1 messages · Page 1 of 1 (latest)

chilly spruce
#

I'm trying to get the wasmtime sample working in zig was able to translate-c the hello.c sample with the command.

zig translate-c --verbose-cimport -I./wasmtime-v1.0.0/include hello.c > hello.zig

But this also translate all the headers. Is there a way to get zig to convert the #include into @cInclude?

upper cloak
#

Not afaik

dapper ermine
#

Yeah no

upper cloak
#

Would be pretty complicated because of the weird semantics of the preprocessor

dapper ermine
#

It would not replace the things ig

chilly spruce
#

Am I correct to say, i could hand translate hello.c to zig and write @cInclude?

upper cloak
#

I mean sure

#

Just translate-c isn't smart enough to do that

dapper ermine
#

Yea

#

You would need to find the things that got translated from hello.c and do the c_import

#

maybe some manual stuff to fix

chilly spruce
#

ya, that's what i'm going with. thanks

upper cloak
#

We're humans. We are infinitely smarter at doing intuitive reasoning of that sort.

chilly spruce
#

but this human has weak c heh

upper cloak
#

lol

#

Can always ask for help

#

Monke together stronk

chilly spruce
#

i'm sure i'll figure it out. at least the main function is in zig now and that is much easier on the eyes