Solved

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

Posted on 2013-11-18
3
408 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 250 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 250 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled

740 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