On Wednesday, 15 June 2016 at 06:56:59 UTC, Joerg Joergonson wrote:
When I try to compile your code I get the following errors:

main.d(953): Error: function core.sys.windows.objbase.CoTaskMemAlloc (uint) is not callable using argument types (immutable(ulong))
main.d(970): Error: can only slice tuple types, not _error_
main.d(974): Error: can only slice tuple types, not _error_

coTaskMemAlloc is defined with ULONG in the objbase.d file... so I have no idea what's going on there.

immutable bufferSize = (funcDesc.cParams + 1) * (wchar*).sizeof;
        auto names = cast(wchar**)CoTaskMemAlloc(bufferSize);

Looks like bufferSize just needs to be cast to uint. Didn't get that error in DMD.


The other two I also don't know:

params ~= new Parameter(method, (name[0 .. SysStringLen(name)]).toUTF8(),

If I run it in ldc I get the error

Error: forward reference to inferred return type of function call 'getParameters'

  private static getParameters(MethodImpl method) {
    Parameter dummy;
    return getParameters(method, dummy, false);
  }

It does compile in DMD though.

OK, adding the return type to the signature should fix that. So:

  private static Parameter getParameters(MethodImpl method)


When running I get the error

 Error loading type library/DLL.

The IDL file is in the same directory

Did you try to pass it an IDL file? No wonder it didn't work - you pass in the type library instead, which is a binary file such as a DLL, EXE or TLB file. You can get the file's path from OleView by highlighting the library on the left (eg Photoshop) and on the right it will show a tree with the path beside "win32".

Reply via email to