469,898 Members | 1,547 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Mixing CS and MC++?

Hello,

is it possible to ``use CS to code a class, and (M)C++ for the logic''?
Sorry if this sounds vague, I'm not really sure myself what it means. Does
anyone have any ideas?

--
Daniel
Nov 16 '05 #1
4 1500
Daniel,

You can use VB, C# or C++ (managed) to create a batch of class libraries
(DLL's), and then these can be referenced in one solution...

A project can only be coded in one format, but a solution can contain many
projects, which can be a mixture.

Does that make sense?

Dan

"Daniel Lidström" <so*****@microsoft.com> wrote in message
news:78***************************@40tude.net...
Hello,

is it possible to ``use CS to code a class, and (M)C++ for the logic''?
Sorry if this sounds vague, I'm not really sure myself what it means. Does
anyone have any ideas?

--
Daniel

Nov 16 '05 #2
Daniel Lidström wrote:
Hello,

is it possible to ``use CS to code a class, and (M)C++ for the
logic''? Sorry if this sounds vague, I'm not really sure myself what
it means. Does anyone have any ideas?


Is it possible to declare a class in C# and implement the methods of the
class in MC++? No. Not directly anyway.

Is it possible to implement a class in C# and use it from MC++? Yes.

Is it possible to implement a class in MC++ and use it from C#? Yes.

Is it possible to call functions written in C++ from a class written in C#?
Yes.

Hopefully one of those was the question you were trying to ask...

-cd


Nov 16 '05 #3
The *only* real point in using managed c++ is either
1) to migrate legacy code to managed code
2) for managed code to interact with unmanaged code with the best possible
performance.

It sounds like your aim is (2).
Basically, if you need to use unamanaged code in your managed application,
for reasons of security and/or speed, then write that unmanaged code in
unmanaged C/C++, and *then*, after having tested it, write as thin a wrapper
as possible round it in managed c++. This should be minimalistic, non-logic
containing code, the minimum that is required to interface between C# and
the unmanaged functions. You can have a DLL that has some .cpp /.c files
compiled with /clr, and some .cpp files that are compiled without /clr. The
ones compiled without /clr have no concept of what managed code is, yet as
far as the C# side is concerned, it's a normal, managed, .NET class library.
No PInvoke or COM required.
"Daniel Lidström" <so*****@microsoft.com> wrote in message
news:78***************************@40tude.net...
Hello,

is it possible to ``use CS to code a class, and (M)C++ for the logic''?
Sorry if this sounds vague, I'm not really sure myself what it means. Does
anyone have any ideas?

--
Daniel

Nov 16 '05 #4
And if you want to use unmanaged c++, that's easy enough too using p/invoke interop

http://www.codeproject.com/csharp/unmanage.asp

Joel Martinez
http://www.onetug.org - Orlando .NET User Group
http://www.codecube.net - blog

"Dan Bass" <danielbass [at] postmaster [dot] co [dot] uk> wrote in message news:<uM**************@TK2MSFTNGP11.phx.gbl>...
Daniel,

You can use VB, C# or C++ (managed) to create a batch of class libraries
(DLL's), and then these can be referenced in one solution...

A project can only be coded in one format, but a solution can contain many
projects, which can be a mixture.

Does that make sense?

Dan

"Daniel Lidström" <so*****@microsoft.com> wrote in message
news:78***************************@40tude.net...
Hello,

is it possible to ``use CS to code a class, and (M)C++ for the logic''?
Sorry if this sounds vague, I'm not really sure myself what it means. Does
anyone have any ideas?

--
Daniel

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Daniel Lidström | last post: by
1 post views Thread by Philip | last post: by
2 posts views Thread by Lev | last post: by
1 post views Thread by Daniel Lidström | last post: by
8 posts views Thread by WebSnozz | last post: by
3 posts views Thread by Bruno LIVERNAIS | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.