Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What is the advantage of 'Integrate C project into C# project' vs 'Import DLL into C# project'

Posted on 2013-11-18
3
Medium Priority
?
420 Views
Last Modified: 2013-11-19
Hi experts
I have a C# project that needs to call a method (already) implemented in a C project.

There're two possibilities I could think of.
1. Integrate the C project into the C# project.
2. Build the C project into a DLL, and the C# project imports the DLL.

But I understood approach #1 is also effectively turning the integrated C project into a DLL.
It seems to me there is no benefit from approach #1. Is my understanding correct? Thanks.
0
Comment
Question by:dominicwong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Assisted Solution

by:Rikin Shah
Rikin Shah earned 1000 total points
ID: 39658539
Yes, approach  #1 will similarly do the same thing. If you are not going to change the code in C Project then I would recommend you import the DLL only.
0
 
LVL 9

Accepted Solution

by:
QuinnDex earned 1000 total points
ID: 39658553
you will have to write a dll to integrate your C/C++ code with .NET either way how you do it effects how you can use the c code in your c# app.

You can either write a normal C dll and call it through interop like any other C dll in C#. This is somewhat ugly on the C# side of the program, but you could use the same dll from your C programs.

 Somewhat nicer from a .NET point of view is writing a managed wrapper, also called a mixed mode dll. C++/CLI compiles to a normal .NET assembly, that looks, behaves and works the same as any dll written in C#.

 In C++/CLI you can include unmanaged code. Most of the time this is used to bring legacy C code into a new .NET application
0
 

Author Closing Comment

by:dominicwong
ID: 39658686
Thanks rikin_shah and QuinnDex.

Would you have any idea to my other DLL related question please:
http://www.experts-exchange.com/Programming/Languages/.NET/Q_28297745.html
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question