Calling a C++ Object from D

Zachary Lund admin at computerquip.com
Tue Jan 24 04:46:38 PST 2012


On Tuesday, 24 January 2012 at 12:30:26 UTC, David Eagen wrote:
> I'm trying to understand how to call a C++ library from D. 
> Specifically,
> the Windows Update API.
>
> My goal is rather simple in that I want to detect whether there 
> is a
> reboot pending for the system. To do that I need to call the
> ISystemInformation::RebootRequired property but I don't know 
> how to do
> that in D. Information about the call is at
> http://msdn.microsoft.com/en-us/library/aa386098(v=vs.85).aspx.
>
> I have the C++ header and have successfully defined 
> VARIANT_BOOL,
> VARIANT_TRUE, and VARIANT_FALSE. The last bit to do is to 
> define the
> ISystemInterface object itself and the RebootRequired method. 
> How do I do
> that?
>
> -Dave

 From what I understand, the most reliable way currently is to 
wrap the C++ API in a C API and then call the C API from D. It's 
easy but time consuming and can't be generated currently.


More information about the Digitalmars-d-learn mailing list