Native wrappers : COM vs Mixed assemblies

P

pkcser

Hi,

I am new to .Net development, so please excuse me if some of the
questions ....
So I have Win32 library (using Bluetooth) and I have to expose its
functionality to .Net developers.
I think I have 3 options:
1) Re-implement it in C# - looks impossible:
1) I have to call several native methods with complex parameters like
WSALookupServiceBegin
2) I do not have AF_BTH and similar socket functionality in .Net Socket
releated classes
2) Create a COM wrapper so any .Net language could use it (easy task)
3) Write mixed assembly

So my question is what is your opinion - should I create COM or Mixed
Assembly?

Thanks in advance:
Trever
 
B

Bruno van Dooren

Hi Trever,
1) Re-implement it in C# - looks impossible:
1) I have to call several native methods with complex parameters like
WSALookupServiceBegin
that would be the hard way indeed. Probably only to be done as a research
project, or if you don't know what to do with your free time. :)
2) I do not have AF_BTH and similar socket functionality in .Net Socket
releated classes
2) Create a COM wrapper so any .Net language could use it (easy task)
that would indeed be one of the options. not my favorite, because I'd rather
choose .NET over COM for new projects.
3) Write mixed assembly
that's another option: creating a class library that exports .NET functions
instead of native functions.

I think you are forgetting option number 4:
You mention you already have a win32 library that exposes your
functionality.
if so, you can create a wrapper class library in C#, using DllImport to
PInvoke each of the functions in your your original dll.
that is very easy if your dll interface is not too complex.

how to proceed depends a bit on what you know best. it depends on what you
know best: C++.NET or C#.
Based on the answer to that question, I would personally go with option 3 or
4.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
T

trever

Thanks Bruno,

I would agree your option is really interesting (may the best)
It will require some small redisign form my site (Objects herarcy)
But I think it is very neat soltution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top