Solved

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Graphics 2 27
Footer for each row on Gridview 2 21
C# winforms programmitically move panels 6 28
What Does This C# Code Block Do? 5 26
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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!
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

786 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