midl

MIDL generates the same file for /env win32 and /env win64

In Visual Studio, when you compile foo.idl, MIDL generates the proxy information in foo_p.c. Unfortunately, for Win32 and x64 files, it generates the same file. For Win32, the file starts with: #if !defined(_M_IA64) && !defined(_M_AMD64) For x64, the file starts with: #if defined(_M_AMD64) When you build for Win32 and then immedia...

Microsoft MIDL does not report an error if a typedef uses an unknown type, is it a bug?

I would like to know whether I am missing something: //this is test.idl typedef foo foo_t; // end of test.idl When I compile test.idl with the following command: midl /W4 test.idl I get this output Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0366 Copyright (c) Microsoft Corporation 1991-2002. All rights reserved. Processing ....

Different output from midl.exe 6 and midl.exe 7

I'm tyring to convert a MSVC project from VS 2005 to VS 2008. It contains a IDL file that outputs a header and stubs used for RPC. The VS 2005 project uses MIDL.exe version 6.00.0366. The VS 2008 project uses MIDL.exe version 7.00.0500. Here's the problem: MIDL v6 outputs the following prototype for me to implement in my server code: ...

Defining a pure base class using IDL

When I define an interface in IDL which does not derive from anything, the MIDL precompiler warns as such (Visual C++ 2008) : warning MIDL2271 : [object] interfaces must derive from another [object] interface such as IUnknown (...) And if I derive my interface from another which does not derive from IUnknown, MIDL fails : error ...

No type definitions in pre-defined IDL FILE

Firstly, Using plain C++, without ATL, MFC attempting to use COM Object interface. Using oleview (OLE/COM Object viewer) - used to engineer the IDL code. At this stage, using MIDL Compiler, now I'm having trouble trying to produce the following: Syntax on cmd line: midl /nologo /env win32 /tlb ".\S8_.tlb" /h ".\S8_.h" /iid ".\S8_i.c...

IDL, ODL, MIDL, DLLs but not COM if I can help it.

Using Matt Curland's Type Library Editor, I wrote a Typelib for Nick Yakowlew's Charset Detector Library. This is a standard DLL (written in Delphi as it happens) and not a COM DLL at all. Up until this point I had been building ODL and thus TLB files "by hand". The benefit of this was that I could get Intellisense working in Visual Stu...

may COM server reallocate ([in, out] CACLSID * arg) ?

With a COM interface method declared as this: [ object, uuid(....), ] interface IFoo : IUnknown { HRESULT Foo([in, out] CACLSID * items); } With regards to marshalling, is the server allowed to reallocate the counted array? (I think it is, but I am not sure anymore) Its current implementation only replaces the existing ID's, but...

COM API - could not pass "NULL" for a pointer argument

I have a COM API foo, the IDL looks like: foo([in] unsigned long ulSize, [in, size_is(ulSize)] unsigned char* pData) when I consume this function with foo(0,NULL); I get an error - NULL argument passed. Is there a way to workaround this? ...

What's the purpose of noncreatable coclasses in IDL?

What is the reason for declaring noncreatable coclasses like the following in IDL? [ uuid(uuidhere), noncreatable ] coclass CoClass { [default] interface ICoClass; }; I mean such class will not be registered to COM anyway. What's the reason to mention it in the IDL file and in the type library produced by compiling that ID...

is there a way to have midl generate each interface in a separate .h ?

I have a bunch of objects that inherit abstracts interfaces generated from an idl file. Each object that use of theses interfaces include the same file interfaces.h which contain all the c++ generated abstract classes that map to the idl interface. Each time I change anything into interfaces.idl every classes that depend on this have to...

How can I get MIDL to search additional include directories for qualified paths

Update: Just over six months after opening a support call to Microsoft it has been rejected, they claim it is not a bug (since the documentation doesn't explicitly say that the behaviour seen isn't the correct one). They rejected the DCR saying that since they haven't heard any complaints in the last 10 years this is obviously not an com...

MIDL changes case of identifier when compiling IDL file

I've got a snippet of IDL that looks like this: [ object, uuid(...), pointer_default(unique) ] interface IVirtualMachine { /* ... */ } [ object, uuid(...), pointer_default(unique) ] interface IVirtualServer : IUnknown { HRESULT FindVirtualMachine( [in] BSTR configurationName, [out,retval] IVirtualMachine **virtualMa...

Any sense in marking an IUnknown-derived interface as dual in IDL?

Reviewing our code I've found a curious definition in one of .idl files: [ object, uuid(uuidhere), dual, nonextensible, oleautomation, hidden ] interface IOurInterface : IUnknown { //methods here }; How can an interface derived directly from IUnknown possibly be a dual interface? Will anything break if I re...

Weird namespace addition when importing a typelib

I want to add a method accepting IStream* to my COM interface. Here's the idl excerpt: import "oaidl.idl"; import "ocidl.idl"; import "objidl.idl";//IStream is declared in this .idl file [ uuid(uuidhere), version(1.0) ] library MyLibrary { importlib("stdole32.tlb"); importlib("stdole2.tlb"); [ object, uuid(...

Define a struct in a midl generated header file

I am in the process of automating the build of a legacy product and have hit a wall... I have a .idl file that is compiled in VC++ 6.0 using midl to generate a .tlb, .h and .c file that has a manual build step to add: struct StructDef; Just ahead of an MIDL_INTERFACE in the generated .h file. The rest of the .h file uses the definit...

Problem with name collision in an IDL file

We have an idl file with multiple interfaces defined, two of which have somehting like this: [ object, uuid(79E24BAA-DC12-4caf-91DD-2A4D47FED30A), helpstring("ISomeInterface Interface"), pointer_default(unique) ] interface ISomeInterface: IUnknown { [propget, id(2)] HRESULT SOMEMethod([out, retval] BSTR* pValue)...

Struct inheritance in MIDL

I am trying to inherit from and extend a structure defined in MIDL. I used the same syntax as for interface inheritance i.e typedef struct stDBIBinVarDataEx { float x; } MYSTRUCT ; struct struct2 : MYSTRUCT { float y; }; but the compiler generates errors. ...

Smart pointers for Interfaces declared in idl file?

I am compile idl file using MIDL compiler and generating header file. I need to get smart pointer implementations for interfaces defined in my idl file. How to get smart pointers for my interfaces by compile idl using midl? ...

midl.exe cannot load mscorlib.tlb

I'm trying to use midl to turn an idl file into a tlb. However, when I try I get this warning: warning MIDL2015: failed to load tlb in importlib : mscorlib.tlb and I then get a subsequent error: error MIDL2337 : unsatisfied forward declaration : _Object..... I'm certain that the error is due to the first warning. I've tried the same ...

How do I declare an IStream in idl so visual studio maps it to s.w.interop.comtypes?

hi I have a COM object that takes needs to take a stream from a C# client and processes it. It would appear that I should use IStream. So I write my idl like below. Then I use MIDL to compile to a tlb, and compile up my solution, register it, and then add a reference to my library to a C# project. Visual Studio creates an IStream defin...