Interfacing with C++
rikki cattermole
rikki at cattermole.co.nz
Sun Feb 4 08:18:40 UTC 2018
On 04/02/2018 7:54 AM, infinityplusb wrote:
> Hi all
>
> I'm looking to try and write an interface to C++, but given I'm a casual
> dabbler in D, it's slightly beyond my current ability in terms of both
> C++ and D!
>
> As a leg up, how would one translate something like this from C++ to D?
>
> `typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void*
> userdata );`
>
> From my basic understanding I assumed something like:
>
> `alias CvCmpFunc = Typedef!(int) ; `
>
> but then I'm stuck as to where the rest of the parameters would get passed?
> Do I just declare it as a function instead? That wasn't my understanding
> of reading how typedefs worked, however so I'm a little confused.
>
> Any help would be appreciated.
>
> Regards
alias CvCmpFunc = extern(C /* I think */) int function(const void* a,
const void* b, void* userdata);
More information about the Digitalmars-d-learn
mailing list