Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to remove duplicate code from my project 5 47
SSIS Start 2 37
VB.Net creating Contact in Outlook 1 46
Visual Studio 2015 auto inserted code 12 65
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

679 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