Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now