Passing opaque struct between functions/modules

Sarath Kumar sarath at invalid.com
Thu Jan 24 06:23:14 PST 2013


On Thursday, 24 January 2013 at 11:52:57 UTC, Mike Parker wrote:
>
> The only potential bug I see here is in the error message. What 
> you're seeing is a conflict that arises from D's name mangling. 
> The doSomething in libA is expecting a parameter of type 
> libA.Opaque* and getObject is returning the same, whereas the 
> functions in libB are expecting a parameter of type 
> libB.Opaque*.

   It is a bug because even after casting, the compiler gives an 
error. The compiler wants to know the size of the opaque object, 
even though I'm dealing with a pointer only. As Maxim Fomin 
mentioned, the compiler is trying to create an instance of the 
object even when it is declared as extern (C) and it is a pointer.

--
Thanks,
Sarath


More information about the Digitalmars-d-learn mailing list