tags:

views:

332

answers:

3

Hi,

That's what I wanna achieve :

There will be dll which contains only methods which calls my actual methods from my application and I can share that dll with outside world regardless of which methods it includes because actual methods will be in the dll in my application but if some one uses that outside dll he/she can manages to get my application to do something in limits of I desire.

I hope I could describe what I want. I don't know if you have ever used Skype4COM.dll. It actually works like that, it somehow connects to Skype Client and let me call some one I want. For example :

Skype s = new Skype();
s.PlaceCall("phoneNumber");

I import Skype4COM dll in my project and when i write code like above in C#, it connects to Skype and make a call.

I think there is no actual methods which makes calls in Skype4Com.dll. I think it only does have some sort of methods which reach actual methods in Skype API and make the call so whatever the developers change in Skype, it doesn't affect Skype4Com.dll wrapper as long as signature stays the same.

So, that's what I want to achive, I am not quite interested in writing wrappers tho, that was a sample case, I want to write a dll which reachs my API and uses method signatures and let people use the application from outside so as long as the signatures stay same, if I want to change something between block I don't need to change the dll given out to outside..

Thank in advance....

+3  A: 

If I understand you correctly, you want to expose a limited subset of the functions of your application to outside users. In effect, you want to offer a service, but nothing else.

Then you should use Windows Communication Foundation to host a service inside of your application (or elsewhere). This service could use industry-standard protocols like SOAP; or could use REST; or it could use faster binary transfers over TCP/IP for your .NET clients.

It's perfect for a service-oriented situation like yours.

John Saunders
Rest is where it's at, and I've started getting into writing JSON services as well. Very cool stuff from an API standpoint.
TahoeWolverine
+1  A: 

What you're describing is a COM wrapper around Skype. If you really want a COM wrapper around your C# DLL, you can do that. Microsoft has provided an example that demonstrates how to create a COM Class from C#.

If you're looking into providing a wrapper around your code from managed DLLs, then it's as simple as providing a public interface that consumers of your DLL can use. You'll probably also want to install your code in the GAC (Global Assembly Cache) so that anyone that wants to call into your API can do so without putting copies of your code all over their system.

jasonh
What do you think about a WCF Service over a COM wrapper? COM has all those registry issues...
John Saunders
True. How hard is it for a COM component to communicate with a WCF service? I'm thinking there may have been a reason the OP chose Skype as an example.
jasonh
It's possible, but he'd have to tell us. It's also possible he's familiar with COM (VB6, maybe).
John Saunders
+1  A: 

You could make everything internal instead of public inside this DLL. Internal keyword restricts access to classes, methods or properties to assembly while public keyword allows access from other assemblies

Sergej Andrejev