why cant I mix MC++ code and C# in a single exe ? 
Author Message
 why cant I mix MC++ code and C# in a single exe ?

Why cant I mix MC++ code and C# code in a single exe ?

This is very perplexing as I can mix just about any other
languages together in a single exe.  In fact, part of our app
is a DLL built of 10,000 lines of c code and 400,000 lines
of fortran code.  Works great ! (and those languages are
*very* incompatible).

Thanks,
Lynn



Thu, 27 Jan 2005 10:54:12 GMT  
 why cant I mix MC++ code and C# in a single exe ?
Er, what's stopping you from calling an MC++ DLL from C# or vice versa?

Nish


Quote:
> Why cant I mix MC++ code and C# code in a single exe ?

> This is very perplexing as I can mix just about any other
> languages together in a single exe.  In fact, part of our app
> is a DLL built of 10,000 lines of c code and 400,000 lines
> of fortran code.  Works great ! (and those languages are
> *very* incompatible).

> Thanks,
> Lynn



Thu, 27 Jan 2005 11:27:54 GMT  
 why cant I mix MC++ code and C# in a single exe ?
We have that on the list as a potential feature for a future release.

DO note that even now you can build a single (multi-file) assembly from
netmodules written in multiple languages which gives identical functionality
apart from the packaging issue.

Ronald Laeremans
Visual C++ compiler and libraries team


Quote:
> Why cant I mix MC++ code and C# code in a single exe ?

> This is very perplexing as I can mix just about any other
> languages together in a single exe.  In fact, part of our app
> is a DLL built of 10,000 lines of c code and 400,000 lines
> of fortran code.  Works great ! (and those languages are
> *very* incompatible).

> Thanks,
> Lynn



Fri, 28 Jan 2005 00:19:33 GMT  
 why cant I mix MC++ code and C# in a single exe ?

Quote:
> We have that on the list as a potential feature for a future release.

This fall or next fall <g> ?

Quote:
> DO note that even now you can build a single (multi-file) assembly from
> netmodules written in multiple languages which gives identical functionality
> apart from the packaging issue.

I do not think that I quite understand your answer.  Are you saying
that mixed MC++ and C# in a single exe are doable outside of
Visual Studio .NET ?  And how ?

Thanks,
Lynn McGuire



Fri, 28 Jan 2005 04:25:08 GMT  
 why cant I mix MC++ code and C# in a single exe ?

Quote:
> Er, what's stopping you from calling an MC++ DLL from C# or vice versa?

Nothing.  Except the communication is really a two way process
for the code interface that I need.  I have heard that a C# DLL can
call the parent MC++ exe but I have not seen this demonstrated.

Thanks,
Lynn



Fri, 28 Jan 2005 04:27:00 GMT  
 why cant I mix MC++ code and C# in a single exe ?
Neither would be my guess.

Ronald


Quote:
> > We have that on the list as a potential feature for a future release.

> This fall or next fall <g> ?

> > DO note that even now you can build a single (multi-file) assembly from
> > netmodules written in multiple languages which gives identical
functionality
> > apart from the packaging issue.

> I do not think that I quite understand your answer.  Are you saying
> that mixed MC++ and C# in a single exe are doable outside of
> Visual Studio .NET ?  And how ?

> Thanks,
> Lynn McGuire



Fri, 28 Jan 2005 04:39:25 GMT  
 why cant I mix MC++ code and C# in a single exe ?
Ermm, the C++ compiler compiles C++ and the C# compiler compiles C#.

I am not sure what tools you are using to compile your app, but I guess you
are either using some kind of preprocessor to convert FORTRAN to C (or C to
FORTRAN) with mixed FORTRAN/C files or you have a collection of C files and
a collection of FORTRAN files and are compiling each with an appropriate
compiler to COFF .obj files and linking them all together.

It is possible to do the latter in .NET with a multi-module assembly. The C#
compiler is invoked:

csc /t:module /out:a.netmodule a.cs

the C++ compiler is invoked like this:

cl /clr:noAssembly /LD /out:b.netmodule b.cpp

and the linker is invoked like this:

link /assemblymodule:a.netmodule /assemblymodule:a.netmodule /out:<assem>

where <assem> is the name of the assembly (add /DLL to linker if <assem> is
a library assembly).

Richard

--
Richard Grimes [MVP]
author: "Programming with Managed Extensions for Visual C++ .NET",
the Microsoft Press book about Managed C++


Quote:
> Why cant I mix MC++ code and C# code in a single exe ?

> This is very perplexing as I can mix just about any other
> languages together in a single exe.  In fact, part of our app
> is a DLL built of 10,000 lines of c code and 400,000 lines
> of fortran code.  Works great ! (and those languages are
> *very* incompatible).

> Thanks,
> Lynn



Tue, 01 Feb 2005 03:54:28 GMT  
 why cant I mix MC++ code and C# in a single exe ?

Quote:
> and the linker is invoked like this:

> link /assemblymodule:a.netmodule /assemblymodule:a.netmodule /out:<assem>

> where <assem> is the name of the assembly (add /DLL to linker if <assem> is
> a library assembly).

Yup, got that.  But, apparently the Visual Studio .NET environment
does not allow you to do this.

I could not figure out how to do the #using in the managed C++ code.

Thanks,
Lynn



Wed, 02 Feb 2005 00:26:59 GMT  
 why cant I mix MC++ code and C# in a single exe ?

Quote:

> Yup, got that.  But, apparently the Visual Studio .NET environment
> does not allow you to do this.

> I could not figure out how to do the #using in the managed C++ code.

Hi Lynn,
  What about the #using doesn't work? You can build the C# .netmodule by
using the /target:module switch, which unfortunately isn't accessible via
the C# project system. Then using that .netmodule, you can do the following:
  #using "example.netmodule"

The same works the other way for C++. You can generate a .netmodule with the
/NOASSEMBLY and /DLL switch to the linker. Then you just use the
/r:example.dll switch to the C# compiler.

--
Brandon Bray           Visual C++ Language Compiler and CRT Program Manager
This posting is provided "AS IS" with no warranties, and confers no rights.



Wed, 02 Feb 2005 09:24:59 GMT  
 why cant I mix MC++ code and C# in a single exe ?
Can you just create two projects (one C#, one MC++) that use the same
namespace?  Add them as references?


Quote:
> Why cant I mix MC++ code and C# code in a single exe ?

> This is very perplexing as I can mix just about any other
> languages together in a single exe.  In fact, part of our app
> is a DLL built of 10,000 lines of c code and 400,000 lines
> of fortran code.  Works great ! (and those languages are
> *very* incompatible).

> Thanks,
> Lynn



Mon, 07 Feb 2005 05:52:50 GMT  
 why cant I mix MC++ code and C# in a single exe ?

Quote:

> Can you just create two projects (one C#, one MC++) that use the same
> namespace?  Add them as references?

Hi Eric,
  You can share information across projects via namespaces; however, realize
that each project will create a separate assembly. That may or may not be
what you want to do.

--
Brandon Bray                                            Visual C++ Compiler
This posting is provided "AS IS" with no warranties, and confers no rights.



Tue, 08 Feb 2005 06:41:55 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. MC++ versus C# code

2. Internal Compiler Error while deriving C# class from a MC++ class implementing a C# interface

3. New C# Source Code Sample - Running JScript.NET Code from C# Apps

4. cant use application name when debugging com+ apps through dllhost.exe

5. Cant Access Com Exe Started From Nt Service

6. .exe icon in MC++

7. limitation with MC++, Remoting, CAO, and soapsuds.exe

8. soapsuds and MC++ .exe

9. MC.EXE and VC6

10. MC.exe & FormatMessage

11. Cant install the VC - Samples?WHY!?

12. why cant you assign a char* to ctime()?

 

 
Powered by phpBB® Forum Software