I am struggling with something seemingly super-simple: I'd like to use the MIDL compiler to generate a type library (.tlb
file) from a .idl
file. However, I just can't get MIDL to generate a .tlb
file.
This is my Foo.idl
:
import "unknwn.idl";
[object, uuid(400075B9-4BD6-45A5-B8B7-9DA0CF7B9B13)]
interface IFoo : IUnknown
{
HRESULT DoFoo([in] int arg, [out, retval] int *result);
}
This is how I invoke the MIDL compiler:
midl Foo.idl /tlb Foo.tlb
Which writes the following output to the console:
Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555
Copyright (c) Microsoft Corporation. All rights reserved.
Processing .\Foo.idl
Foo.idl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.idl
unknwn.idl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wtypes.idl
wtypes.idl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\basetsd.h
basetsd.h
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\guiddef.h
guiddef.h
The MIDL compiler produces three files: Foo.h
, Foo_i.c
, Foo_p.c
… but no Foo.tlb
. Am I misunderstanding something, or what has gone wrong here?
library
block is placed into a TLB file. Further, interfaces you want to place into a TLB should bedual
oroleautomation
ordispinterface
. A TLB format can only accurately represent an automation-compatible interface.int
is not an automation type - make it along
. – Toting