Managed code with C# and VC++

  • Thread starter Francis Urquhart
  • Start date
F

Francis Urquhart

I am trying to find the simplest possible way of writing a
GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the
following questions, or point me to some useful references
on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?

2. If so, is it still necessary to write some type of .Net
wrapper to instantiate the C++ objects?

3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?

Again, any feedback or references would be appreciated.

Thanks in advance.
 
N

Nicholas Paldino [.NET/C# MVP]

Francis,

See inline:

Francis Urquhart said:
I am trying to find the simplest possible way of writing a
GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the
following questions, or point me to some useful references
on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?

Yes, it does. You can write managed code which accesses unmanaged code,
but that unmanaged code has to provide a managed interface of some sort.
2. If so, is it still necessary to write some type of .Net
wrapper to instantiate the C++ objects?

Yes, it is. Otherwise, the runtime would have no clue how to interact
with the unmanaged code.
3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?

You should be able to do it without the IDE, you should be able to do it
with just the .NET framework (although it would be a little more difficult,
as everything is from the command line).

Hope this helps.
 
F

Francis Urquhart

Nicholas,

Thanks for your reply. That definitely helps.

Just one follow-up: Would you recommend the C# route
rather than just trying to create a GUI using VC++ alone?
That is, would it be a simpler process to create the .Net
wrapper and code the GUI in C# rather than using the GUI
tools in VC++ (especially if I were to use the .Net
Professional IDE)?

Sorry for all the questions -- I've been working with UNIX
the past five years and know very little about the .Net
environment.

-Francis

-----Original Message-----
Francis,

See inline:

I am trying to find the simplest possible way of writing a
GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the
following questions, or point me to some useful references
on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?

Yes, it does. You can write managed code which accesses unmanaged code,
but that unmanaged code has to provide a managed interface of some sort.
2. If so, is it still necessary to write some type of .Net
wrapper to instantiate the C++ objects?

Yes, it is. Otherwise, the runtime would have no clue how to interact
with the unmanaged code.
3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?

You should be able to do it without the IDE, you should be able to do it
with just the .NET framework (although it would be a little more difficult,
as everything is from the command line).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Again, any feedback or references would be appreciated.

Thanks in advance.


.
 
N

Nicholas Paldino [.NET/C# MVP]

Francis,

I would definitely use C# for the GUI code. It would probably be easier
(IMO), but it all depends on what you are used to. If you can create the
wrappers for your classes, then you really have 95% of the work done, as
there is little to do after that besides create the GUI. If you have
complex GUI requirements, then I would use C++, but if your requirements are
pretty standard, then I would use C# to call your wrapped classes.


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

Francis Urquhart said:
Nicholas,

Thanks for your reply. That definitely helps.

Just one follow-up: Would you recommend the C# route
rather than just trying to create a GUI using VC++ alone?
That is, would it be a simpler process to create the .Net
wrapper and code the GUI in C# rather than using the GUI
tools in VC++ (especially if I were to use the .Net
Professional IDE)?

Sorry for all the questions -- I've been working with UNIX
the past five years and know very little about the .Net
environment.

-Francis

-----Original Message-----
Francis,

See inline:

I am trying to find the simplest possible way of writing a
GUI to run on top of a standard C++ library written in
VC++. I would like to avoid MFCs, COM, and if
possible .Net wrappers. The goal is just to be able to
demonstrate the capabilities of the library, rather than
create a finished product.

I have read things here and there about "managed code",
where you can write a GUI in C# to interface with
C++ "unmanaged" code. However, after searching through
pages and pages on MSDN, plus external sites, I remain
more confused than ever. If anyone could help answer the
following questions, or point me to some useful references
on the web or in print, I would greatly appreciate it.

1. Does managed/unmanaged code (using C# and VC++) allow
you to bypass MFCs and COM?

Yes, it does. You can write managed code which accesses unmanaged code,
but that unmanaged code has to provide a managed interface of some sort.
2. If so, is it still necessary to write some type of .Net
wrapper to instantiate the C++ objects?

Yes, it is. Otherwise, the runtime would have no clue how to interact
with the unmanaged code.
3. Can this be done with the standard .Net 2003 versions
of C# and VC++, or does it require purchasing .Net
Professional?

You should be able to do it without the IDE, you should be able to do it
with just the .NET framework (although it would be a little more difficult,
as everything is from the command line).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Again, any feedback or references would be appreciated.

Thanks in advance.


.
 

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