Calling a cpp function from d

Daniel Kozák via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 16 06:14:56 PDT 2015


On Tue, 16 Jun 2015 13:01:09 +0000
via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> On Tuesday, 16 June 2015 at 12:42:16 UTC, C2D wrote:
> > On Tuesday, 16 June 2015 at 12:31:23 UTC, John Chapman wrote:
> >> On Tuesday, 16 June 2015 at 12:26:45 UTC, C2D wrote:
> >>> BOOL result = SHGetFolderPath(null, 0x23, null, 0, cache.ptr);
> >>
> >> That should be:
> >>
> >> BOOL result = SHGetFolderPath(null, 0x23, null, 0, buf.ptr);
> >
> > Thanks, but I'm still getting the same error -
> > Error: function files.SHGetFolderPath (void* hwndOwner, int 
> > nFolder, void* hToken, uint dwFlags, char* pszPath) is not 
> > callable using argument types (typeof(null), int, typeof(null), 
> > int, wchar*)
> 
> Because you have declared `buf` as `wchar[...]`. SHGetFolderPath 
> expects `char*`, so use `char[...]` instead.

That is not wise, it could be a wchar.
http://stackoverflow.com/questions/321413/lpcstr-lpctstr-and-lptstr


More information about the Digitalmars-d-learn mailing list