IDL to C#?

  • Thread starter Thread starter Leon_Amirreza
  • Start date Start date
L

Leon_Amirreza

Hi,
Is there any tool that can convert and Interface definitions (especially
oleidl.idl) to C# interface definitions?
does MIDL.exe do that? i could just get c++ header files.
or any way i can compile Vc++ header files to an assembly that i can import
to c# projects? if yes please describe step by step as i am naive in Vc++.
 
Is there any tool that can convert and Interface definitions (especially
oleidl.idl) to C# interface definitions?
does MIDL.exe do that? i could just get c++ header files.

MIDL and TlbImp is the way to go. But for MIDL to produce a typelib I
belive you need a library {} block in the IDL file, which is missing
in Oleidl.idl.

But for non automation interfaces like those in Oleidl.idl, the IA
produced by Tlbimp isn't always perfect, and you may have to modify it
to make it really usable. So it's often easier to write your own COM
interface declarations directly in C# instead. You can find examples
of that in the .NET SDK directory
Samples\Technologies\Interop\Applications\ShellCmd



Mattias
 
i added the library {} and command line switches documented in msdn to
generate tbl ; but many attributes used in the oleidl.idl cant be parsed be
midl.exe .
i faced many error messages i dont know was it because i used midl in the
wrong way or what?
 
i faced many error messages i dont know was it because i used midl in the
wrong way or what?

I guess Oleidl.idl wasn't written for the purpose of producing a
typelib. Another good reason to write the interface defs manually
instead.



Mattias
 
Back
Top