By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,124 Members | 1,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,124 IT Pros & Developers. It's quick & easy.

Importing a C project into .NET, and book recommendations

P: n/a
I have files to build a C project, including the makefile, what's the
easiest way to import the project into C and C# in VS .NET Professional? I
have both VS .NET 2002 and 2003.

I have nothing but VB .NET books.
I guess it's time to get a book for each of C++ and C# in .NET.
Any recommendations

--
http://www.standards.com/; See Howard Kaikow's web site.
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Howard,

C# is not the same as C/C++. While there are many similarities, you can
not take the files from one and compile them in another and it will work (in
some cases yes, but in many, no).

If you have a lot of functionality in C/C++, then you might want to
consider accessing that functionality through the P/Invoke layer (if you
have functions exported from DLLs), COM interop (if you have objects exposed
through COM), or creating managed wrappers using Managed Extensions for C++
(if you have class libraries that don't fit into either of the conditions
above). Of course, you can do a conversion to C# if you have the time as
well, but the first three will save you more time, if you are under that
constraint.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Howard Kaikow" <ka****@standards.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
I have files to build a C project, including the makefile, what's the
easiest way to import the project into C and C# in VS .NET Professional? I have both VS .NET 2002 and 2003.

I have nothing but VB .NET books.
I guess it's time to get a book for each of C++ and C# in .NET.
Any recommendations

--
http://www.standards.com/; See Howard Kaikow's web site.

Nov 15 '05 #2

P: n/a
Thanx.

Let me clarify.

The C code is not complex, just simple demonstrations of sorting algorithms.
It likely would not be difficult to start a C# or C++ project in .NET and
copy the code.
I was just hoping to find an easier way.

Should be someway to tell .NET to make a project from the makefile.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ek**************@tk2msftngp13.phx.gbl...
Howard,

C# is not the same as C/C++. While there are many similarities, you can not take the files from one and compile them in another and it will work (in some cases yes, but in many, no).

If you have a lot of functionality in C/C++, then you might want to
consider accessing that functionality through the P/Invoke layer (if you
have functions exported from DLLs), COM interop (if you have objects exposed through COM), or creating managed wrappers using Managed Extensions for C++ (if you have class libraries that don't fit into either of the conditions
above). Of course, you can do a conversion to C# if you have the time as
well, but the first three will save you more time, if you are under that
constraint.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Howard Kaikow" <ka****@standards.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
I have files to build a C project, including the makefile, what's the
easiest way to import the project into C and C# in VS .NET
Professional? I
have both VS .NET 2002 and 2003.

I have nothing but VB .NET books.
I guess it's time to get a book for each of C++ and C# in .NET.
Any recommendations

--
http://www.standards.com/; See Howard Kaikow's web site.


Nov 15 '05 #3

P: n/a
Howard,

You can compile C++ code in .NET, but you will have to make some
adjustments. For example, if it is not object oriented code, then you will
have to make it so that it is (using static methods instead of having
functions, for example).

Also, I don't believe that the IDE knows about makefiles. Rather, you
will have to create a project file and add your files to the project.

You can still use NMAKE to compile your files with the makefile.
However, this will give you just what you had before, an unmanaged dll.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Howard Kaikow" <ka****@standards.com> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Thanx.

Let me clarify.

The C code is not complex, just simple demonstrations of sorting algorithms. It likely would not be difficult to start a C# or C++ project in .NET and
copy the code.
I was just hoping to find an easier way.

Should be someway to tell .NET to make a project from the makefile.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ek**************@tk2msftngp13.phx.gbl...
Howard,

C# is not the same as C/C++. While there are many similarities, you

can
not take the files from one and compile them in another and it will work

(in
some cases yes, but in many, no).

If you have a lot of functionality in C/C++, then you might want to
consider accessing that functionality through the P/Invoke layer (if you
have functions exported from DLLs), COM interop (if you have objects

exposed
through COM), or creating managed wrappers using Managed Extensions for

C++
(if you have class libraries that don't fit into either of the conditions above). Of course, you can do a conversion to C# if you have the time as well, but the first three will save you more time, if you are under that
constraint.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Howard Kaikow" <ka****@standards.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
I have files to build a C project, including the makefile, what's the
easiest way to import the project into C and C# in VS .NET

Professional?
I
have both VS .NET 2002 and 2003.

I have nothing but VB .NET books.
I guess it's time to get a book for each of C++ and C# in .NET.
Any recommendations

--
http://www.standards.com/; See Howard Kaikow's web site.



Nov 15 '05 #4

P: n/a
You know the other way of looking at it is that you will probably learn C#
as you port your code.

Making lemonade, ya know,

doug

"Howard Kaikow" <ka****@standards.com> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Thanx.

Let me clarify.

The C code is not complex, just simple demonstrations of sorting algorithms. It likely would not be difficult to start a C# or C++ project in .NET and
copy the code.
I was just hoping to find an easier way.

Should be someway to tell .NET to make a project from the makefile.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ek**************@tk2msftngp13.phx.gbl...
Howard,

C# is not the same as C/C++. While there are many similarities, you

can
not take the files from one and compile them in another and it will work

(in
some cases yes, but in many, no).

If you have a lot of functionality in C/C++, then you might want to
consider accessing that functionality through the P/Invoke layer (if you
have functions exported from DLLs), COM interop (if you have objects

exposed
through COM), or creating managed wrappers using Managed Extensions for

C++
(if you have class libraries that don't fit into either of the conditions above). Of course, you can do a conversion to C# if you have the time as well, but the first three will save you more time, if you are under that
constraint.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Howard Kaikow" <ka****@standards.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
I have files to build a C project, including the makefile, what's the
easiest way to import the project into C and C# in VS .NET

Professional?
I
have both VS .NET 2002 and 2003.

I have nothing but VB .NET books.
I guess it's time to get a book for each of C++ and C# in .NET.
Any recommendations

--
http://www.standards.com/; See Howard Kaikow's web site.



Nov 15 '05 #5

P: n/a
I found something in the online Help yesterday about using File | Open
Workspace, and the IDE did open the makefile, but then I could not figure
out what to do.

I spent a lot of time searching through the .NET Help to no avail.
Surely, the importing of the vast amount of extant code has to be a high
priority item.

But I've not been able to find out how to do the deed.

I do have an old copy of VS C/C++ 6 learning editions that came with books.
I could build a project there and then let .NET import the critter, but
there should be a more direct way.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Oh**************@TK2MSFTNGP10.phx.gbl...
Howard,

You can compile C++ code in .NET, but you will have to make some
adjustments. For example, if it is not object oriented code, then you will have to make it so that it is (using static methods instead of having
functions, for example).

Also, I don't believe that the IDE knows about makefiles. Rather, you
will have to create a project file and add your files to the project.

You can still use NMAKE to compile your files with the makefile.
However, this will give you just what you had before, an unmanaged dll.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Howard Kaikow" <ka****@standards.com> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Thanx.

Let me clarify.

The C code is not complex, just simple demonstrations of sorting

algorithms.
It likely would not be difficult to start a C# or C++ project in .NET and
copy the code.
I was just hoping to find an easier way.

Should be someway to tell .NET to make a project from the makefile.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote

in
message news:ek**************@tk2msftngp13.phx.gbl...
Howard,

C# is not the same as C/C++. While there are many similarities, you
can
not take the files from one and compile them in another and it will
work (in
some cases yes, but in many, no).

If you have a lot of functionality in C/C++, then you might want
to consider accessing that functionality through the P/Invoke layer (if you have functions exported from DLLs), COM interop (if you have objects

exposed
through COM), or creating managed wrappers using Managed Extensions for C++
(if you have class libraries that don't fit into either of the

conditions above). Of course, you can do a conversion to C# if you have the time as well, but the first three will save you more time, if you are under

that constraint.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Howard Kaikow" <ka****@standards.com> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl...
> I have files to build a C project, including the makefile, what's the > easiest way to import the project into C and C# in VS .NET

Professional?
I
> have both VS .NET 2002 and 2003.
>
> I have nothing but VB .NET books.
> I guess it's time to get a book for each of C++ and C# in .NET.
> Any recommendations
>
> --
> http://www.standards.com/; See Howard Kaikow's web site.
>
>



Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.