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
Solved

DLL Library in C#

Posted on 2006-07-22
6
373 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
  • 3
  • 2
6 Comments
 
LVL 9

Assisted Solution

by:jonorossi
jonorossi earned 200 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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 300 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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