MSIDL to C#

  • Thread starter Thread starter Random Task
  • Start date Start date
R

Random Task

Can anyone tell me if it is possible to generate C# from IDL/MSIDL ...

I would love a www refence with a command example if possible :-)

Cheers,
Random
 
Random,

Oddly enough, it is possible, but it won't ALWAYS map correctly.
However, most of the time, it does.

You should check out Reflector, located at (watch for line wrap):

http://www.aisto.com/roeder/dotnet/

Basically, you can compile the IL into an assembly, then disassemble it
using this tool, and it will give you the C# source code.

Hope this helps.
 
I have a spec for a framework ... it is all specified in OMG IDL (i.e.
CORBA) ... i wanna write the code in C# (not C++ ada etc) ... so i wanna
generate classes from the IDL ... make sense?
Random,

Oddly enough, it is possible, but it won't ALWAYS map correctly.
However, most of the time, it does.

You should check out Reflector, located at (watch for line wrap):

http://www.aisto.com/roeder/dotnet/

Basically, you can compile the IL into an assembly, then disassemble it
using this tool, and it will give you the C# source code.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Can anyone tell me if it is possible to generate C# from IDL/MSIDL ...

I would love a www refence with a command example if possible :-)

Cheers,
Random

The OP said I*D*L not IL. I guess he's talking about the COM interface
definition language - or a typo ;-)

You cannot generate C# from IDL AFAIK. Things like IUnknown have no
correlation in .NET as its garbage collected rather than reference counted.

What are you trying to acheive?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk?
 
I have a spec for a framework ... it is all specified in OMG IDL (i.e.
CORBA) ... i wanna write the code in C# (not C++ ada etc) ... so i wanna
generate classes from the IDL ... make sense?
 
Sorry here's my actual problem:

I have a spec for a framework ... it is all specified in OMG IDL (i.e.
CORBA) ... i wanna write the code in C# (not C++ ada etc) ... so i wanna
generate classes from the IDL ... make sense?
 
Nicholas Paldino said:
Random,

Oddly enough, it is possible, but it won't ALWAYS map correctly.
However, most of the time, it does.

You should check out Reflector, located at (watch for line wrap):

http://www.aisto.com/roeder/dotnet/

Basically, you can compile the IL into an assembly, then disassemble it
using this tool, and it will give you the C# source code.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Random Task said:
Can anyone tell me if it is possible to generate C# from IDL/MSIDL ...

I would love a www refence with a command example if possible :-)

Cheers,
Random

The OP said I*D*L not IL. I guess he's talking about the COM interface
definition language - or a typo ;-)

You cannot generate C# from IDL AFAIK. Things like IUnknown have no
correlation in .NET as its garbage collected rather than reference counted.

What are you trying to acheive?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk?
 
Random Task said:
Can anyone tell me if it is possible to generate C# from IDL/MSIDL ...

I would love a www refence with a command example if possible :-)

Cheers,
Random

You can't directly generate C# from IDL, if your IDL file is a COM IDL, you
can use the typelib (created from your IDL file using MIDL.EXE) as input for
tlbimp.exe to create an interop assembly.

Willy.
 
I see what you mean now. Well, I don't know if this will work, but you
could run the OMG IDL through the MIDL compiler (I'm not familiar with OMG
IDL in relation to MIDL, I'm assuming they are somewhat the same). It
should spit out a type library.

You could then set an interface to that type library in your project,
and then implement it on your classes.
 
Willy said:
You can't directly generate C# from IDL, if your IDL file is a COM IDL, you
can use the typelib (created from your IDL file using MIDL.EXE) as input for
tlbimp.exe to create an interop assembly.

Willy.

Thank you ... that's really to bad ... i'll definitely consider doing
things the way you have suggested ... I was hoping to get some free code
generated for me :-)
 
Random Task said:
Thank you ... that's really to bad ... i'll definitely consider doing
things the way you have suggested ... I was hoping to get some free code
generated for me :-)

Don't know what you are after but MIDL does generate 'C' code only, not C#
code, but it won't generate a typelib from OMG IDL.
Note also that there is no mapping of OMG CORBA API's to .NET, so even the C
stubs cannot be used with the Framework , so your only option is C++ (even
Managed C++ will do and is part of .NET) and CORBA.

Willy.
 
You can also take a look at:

http://remoting-corba.sourceforge.net/

It's a C# library that basically maps the C# remoting to corba.

They have an IDL compiler as well that may be closer to what you need, but
you'll need to get it out of CVS and build it since they haven't released it
yet (I don't think).

Pete
 
Back
Top