#[solved] Automated access to C code with extern instead of translate-c. Is it possible?

1 messages · Page 1 of 1 (latest)

queen bramble
#

I can imagine the answer is going to be no, but is there a way to do this?

I could potentially write the extern fn some_c_function() declarations manually...
but I was wondering if an automated option is already available somehow.

simple sparrow
#

making automated extern fn is what translate-c does

simple sparrow
#

headers generally don't contain the source they only contain the signature (at least not without a impl flag)
which means it will generate extern functions

how would the c library be able to import the header if your translate-c zig also exports the symbol it cant (if it linked to the zig module)
you also couldnt import the header into multiple files in c (or if its imported multiple times without a header guard / pragma once)

extern means you aren't looking for the source anyways so why are you including it in that translate-c arg? just add the C source file in a separate step / link against the already generated lib (not in a translate-c part)

I assume that the only case that doesnt cover is macros which I dont have an answer for

queen bramble