Problem Passing Struct to C

bearophile bearophileHUGS at lycos.com
Fri May 6 10:39:48 PDT 2011


Mike Parker:

> Testing out a new binding I knocked up for a C library. One of the 
> functions takes a struct by value. It looks somewhat like this:
> 
> struct S {}
> struct Color
> {
>      float r,g,b,a;
> }
> 
> extern C void function(S* s, Color color, int x, int y, in char*) draw_text;

My suggestion is:
1) create a test case that shows your program with minimal D code and minimal C code.
2) Create the binary
3) Disassembly it, take a look at the ASM and find the relevant parts, or show them here...

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list