How do I write a COM dll?
To better myself I am attempting to make my dll's COM compliant, I thought I'd just need to extend/implement a few interfaces and job done but now I am at a cross roads,
1) Should I learn MIDL?
2) Should I install the ATL (I am running VC++Express)?
3) Carry on reading the C++ tutorials (http://progtutorials.tripod.com开发者_如何转开发/COM.htm) and hope my Express edition is too limited?
I was interested in transferring native C++ to Android and Java and read that the libraries would need to expose either static 'C' style functions or implement COM.
Android is Linux based operating system... It does not support DLLs and COM.
So no you can't go via COM. You need to learn how to use JNI.
1) Yes. If you are going to define new interfaces, you pretty much have to. It's not impossible to do without MIDL, but it's way harder than to learn basic MIDL.
2) Yes, please do. It'll hide much of the boiler plate code (which is tedious to write, and error prone).
3) I would recommend the book Essential COM by Don Box. It's awesome. Also, a great companion to that book is Essential IDL by Martin Gudgin.
As for VC++ Express - I have never used them. I guess it's possible to do COM with it, but with limited tool/library support.
精彩评论