C++ Interop -- Two Questions

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 9 04:44:04 PDT 2015


On 2015-09-09 11:55, Mike Parker wrote:
> Given a C++ class that looks like this:
>
> class Foo {
>     static void Initialize(const SomeObject&);
>
>     virtual void func1();
> }
>
> The documentation at [1] doesn't say anything about how to handle static
> member functions like Initialize, nor do I see anything about
> references. I assume I can declare any reference function parameters
> using D's ref, but I have no idea how to declare static methods. My
> questions:
>
> 1) Am I right about ref?

I would assume so. It's just a pointer under the hood.

> 2) Do I need to create a wrapper function in C or C++ for static member
> functions?

The documentation for the C++ support is very outdated. I recommend to 
give it a try and see what happens :). Alternatively look in the DMD 
test suite and see what you can find, or the DMD source code now when 
it's in D.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list