[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

DLL Library in C#

Posted on 2006-07-22
6
Medium Priority
?
377 Views
Last Modified: 2010-04-16
How do I create a standard DLL library (not an assembly housed in a DLL) in C#, so that it can be used by unmanaged applications?
0
Comment
Question by:campinas
[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
  • 2
6 Comments
 
LVL 9

Assisted Solution

by:jonorossi
jonorossi earned 800 total points
ID: 17160687
That is not possible, C# code will always been managed code however you can call methods from unmanaged code. Take a look at these articles:

http://www.codeproject.com/csharp/ManagedCOM.asp
http://www.csharphelp.com/archives/archive190.html
0
 

Author Comment

by:campinas
ID: 17161029
Thanks! So one can access managed components from unmanaged applications...

Then I may need to create a dll based on the "class library" C#/vs.net project type.

But then, how do I call its functions from an unmanaged app?
0
 
LVL 5

Expert Comment

by:paulb1989
ID: 17161355
You will have to write your C# class library as a COM object as is shown in the links jonorossi wrote above. Then from your unmanaged application you can access your C# project as any other COM object.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:campinas
ID: 17161421
The problem is I don'y have access to the source code of the unmanaged app. It's just prewired so that it accepts dll shared libraries, not COM objects. What can I do?
0
 
LVL 5

Accepted Solution

by:
paulb1989 earned 1200 total points
ID: 17161431
Well the only way I can think of is to write your C# class library as a COM object and then create a native DLL (not in C#) which the unmanaged app can load, and make your native dll call your C# COM object.

So you would have the unmanaged app, your managed C# COM object, and an unmanaged dll interfacing between them.
0
 

Author Comment

by:campinas
ID: 17161695
thanks all for helpful comments.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

650 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