c++ interop in the library (just for fun)
Adam D. Ruppe
destructionator at gmail.com
Thu May 30 11:05:17 PDT 2013
On Thursday, 30 May 2013 at 17:29:42 UTC, Timothee Cour wrote:
> We need to support different C++ name mangling schemes.
Right, that's fairly straightforward to implement, we could
probably use a UDA to change it (@VisualCpp void foo()) or choose
the most sane default with version(Windows), version(GDC), etc.
> Also the next step would be:
> mixin(importCPP("myheader.h"));
You know I was actually thinking about that. Either using a dummy
D class and going over it to build the C++ object:
class Test_Cpp {
int num;
int num2;
void talk();
final void sayHi(); // or whatever i dont have the file open
right now
}
alias AccessCpp!Test_Cpp Test; // AccessCPP parses it into the
equivalent c++ definitions then builds out the structs and mangle
schemes
Or reading the .h file like you said. Which would be pretty hard,
even to do just partially, since the C++ definition might have
inline definitions, #includes, macros and so on that just totally
confuse the parser.
More information about the Digitalmars-d
mailing list