Is there a way to mix in regular C or C++ code with C# code? If they can't
be in the same file, then is there a way to use code in a .c or .cpp file in
your Visual C# project and have it correctly compile into the program?
Thanks,
Marc 6 1346
Whoops, I was thinking Compact Framework - for the full framework I'm not
sure, so sorry if I threw out a red herring there.
--
Chris Tacke, eMVP
Advisory Board Member www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems www.applieddata.net
"Marc" <ma**********@hotmail.com> wrote in message
news:ui**************@TK2MSFTNGP12.phx.gbl... Is there a way to mix in regular C or C++ code with C# code? If they can't be in the same file, then is there a way to use code in a .c or .cpp file
in your Visual C# project and have it correctly compile into the program?
Thanks, Marc
Nope. The best you can do is to P/Invoke publicly exported C functions from
a DLL.
--
Chris Tacke, eMVP
Advisory Board Member www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems www.applieddata.net
"Marc" <ma**********@hotmail.com> wrote in message
news:ui**************@TK2MSFTNGP12.phx.gbl... Is there a way to mix in regular C or C++ code with C# code? If they can't be in the same file, then is there a way to use code in a .c or .cpp file
in your Visual C# project and have it correctly compile into the program?
Thanks, Marc
Chris Tacke, eMVP <ct****@spamfree-opennetcf.org> wrote: Whoops, I was thinking Compact Framework - for the full framework I'm not sure, so sorry if I threw out a red herring there.
Nope, you were still completely right - a C# project in VS.NET can only
contain C#. An assembly linked from the command line can contain
modules created in C#, VB.NET or MC++ (or anything else that can
produce modules, I guess!) but VS.NET doesn't allow you to do that (and
I'd generally agree that it's something to avoid).
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Out of interest.... why should I want to avoid it?
I'd love to be able to merge assemblies written in different languages, and
even include unmanaged code, if (for instance) it were called from MC++.
I'm writing in C#, but occasionally I want to do something unmanaged, and
it's so much easier to go via MC++ than P/Invoke.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Chris Tacke, eMVP <ct****@spamfree-opennetcf.org> wrote: Whoops, I was thinking Compact Framework - for the full framework I'm
not sure, so sorry if I threw out a red herring there.
Nope, you were still completely right - a C# project in VS.NET can only contain C#. An assembly linked from the command line can contain modules created in C#, VB.NET or MC++ (or anything else that can produce modules, I guess!) but VS.NET doesn't allow you to do that (and I'd generally agree that it's something to avoid).
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Stu Smith <st*****@remove.digita.com> wrote: Out of interest.... why should I want to avoid it?
Just for reasons of maintainability, I'd say. My guess is that
different bits of VS.NET will want different project options, for
instance - so do you show all the options on a mixed project?
I'm sure there are ways round these questions, but I suspect they would
cause more problems (at least for MS support) than they'd solve.
I'd love to be able to merge assemblies written in different languages, and even include unmanaged code, if (for instance) it were called from MC++. I'm writing in C#, but occasionally I want to do something unmanaged, and it's so much easier to go via MC++ than P/Invoke.
Fair enough. I've never actually looked at how MC++ works in terms of
unmanaged code - does it still go in the same PE file?
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
"Marc" <ma**********@hotmail.com> wrote in message news:<ui**************@TK2MSFTNGP12.phx.gbl>... Is there a way to mix in regular C or C++ code with C# code? If they can't be in the same file, then is there a way to use code in a .c or .cpp file in your Visual C# project and have it correctly compile into the program?
Your C# and C++ can't be in the same project, but they can be in the
same solution (you can have several projects in one solution). How you
hook them up after than is up to you, but MC++ would be any easy way
to bridge the languages. We've done it several times at my company.
If the C# is main app logic, the C++ compiles into a DLL which you
deploy with your .exe. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Martijn |
last post by:
Hi,
I'm new in the XML world. I need to program a C++ application that
writes information of all directories and files on the harddisk to a
XML file. Now that's not really the problem.
I...
|
by: CJD |
last post by:
Hello,
I want to create a server-side object that tracks the clicks of a user
while they do a task in a browser. The tasks would take place on
external web sites. Since there does not seem to be...
|
by: Richard |
last post by:
vector<char*> m_Text;
m_Text.resize(1);
char* foo = "FOO";
char* bar = "BAR";
char* foobar = (char*)malloc(strlen(foo) + strlen(bar) + 1);
if (foobar)
{
strcpy(foobar, foo);
strcat(foobar,...
|
by: puzzlecracker |
last post by:
In one of my applications, I was mixing perror (cerrno )with
cout(iostream) calls and sometimes getting unordered output. The exact
context was to print an error condition as well as cause for...
|
by: Gareth |
last post by:
I want to do the following to strings:
1) Check if first four characters are "DATA"
2) Get the middle 'word' from the following string "DATA 123 xyz" (the
middle word is variable length) -...
|
by: Papadopoulos Giannis |
last post by:
Which do you think is best?
1.
a) type* p;
b) type *p;
2.
a) return (var);
b) return(var);
c) return var;
|
by: Carlos |
last post by:
Hi,
I am now in the process of integrating different sources
of asp .net pages. some of them include page directives with C#, and some
with VB. The problem is that at compilation time there...
|
by: tshad |
last post by:
Can you use Dreamweaver and VS.Net together now?
I have a site that was built with DW code inside (therefore you could not
use VS.Net 2003 with it).
Is this still the case?
Apparently, you...
|
by: Martin Jørgensen |
last post by:
Hi,
I'm trying to move a matlab program into c language. For those who knows
matlab, this is the line I want to program in c:
hx(1:nx,1:ny) = 0; % nx=10, ny=10
It works on a 2-dimensional...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |