IDL to C#?

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++.
 
M

Mattias Sjögren

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
 
L

Leon_Amirreza

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?
 
M

Mattias Sjögren

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top