On Tuesday, 15 March 2016 at 17:10:03 UTC, Adam D. Ruppe wrote:
On Tuesday, 15 March 2016 at 16:56:00 UTC, Chris wrote:
Do you mean I need to void initialize them in the C code or in
D? And if in D, how would I do that, with `static this`?
in D, at the usage point with =void where you declare the
variable of that type. So in your code:
struct C
{
A a = void;
B b = void;
}
though I'm pretty sure it wouldn't matter in this specific
instance because they would be all zeroes anyway... your real
code probably has a char or a float in it, right?
I do not recommend trying that though, it is better to actually
compile+link in the modules.
I'm not 100% sure what you mean with compile+link in the modules.
The structs are all defined in the original (third party) C
header file. It's nothing I added (in which case I would have to
recompile the C library). The C structs in the C library should
be visible to the linker, shouldn't they? Just as when you define:
extern (C): size_t strlen(const char *str);
and the linker will find it automatically. The error I get is as
if the structs were not defined (or as if the lib weren't linked
to).