Solved

DLL Library in C#

Posted on 2006-07-22
6
374 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 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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