How to import COM-dll into D

I am trying to create a D application that uses a COM file (third-party) .dll so that I can clear the text field of another application so that I can hear an error when a certain line appears.

However, the third party does not provide the .lib, .def or .h files that come with the dll (at least with the free trial). I can create a .lib file using implib , but I do not see any of the library functions in the created .lib.

Their (visual C ++) samples use the #import directive to bind it, however this is useless to me ...

On the side of the note, how can I get the correct interfaces (in .di with the template that binds) the dll automatically? I ask that the correct connection does not depend on my (probably incorrect) translation of functions. They have a web page that gives all the features, but the object model is a bit chaotic, to say the least.

+4
source share
2 answers

From what I know, COM libraries provide only a few functions necessary for (un) registering a library and creating objects. However, you can view interfaces and functions in COM.dll using the OLE / COM Object Viewer . It seems to be able to output header files (.h). Subsequently, perhaps you could use htod as a starting point for converting everything to D interfaces.

The DMD distribution seems to include the .COM sample (chello.d, dclient.d, dserver.d), and at first glance it doesn't look as if it would require any LIB explicitly.

Unfortunately, I never used COM in D, so I can no longer advise. Hope this helps in some way.

+1
source

While I have not worked on COM myself, I'm trying to restore Juno on top of Github / he-the-great . Part of the tlbimpd project that will output a D file from a DLL.

I tested the examples and ran tlbimpd successfully. Please try everything for your use and send any questions.

+1
source

Source: https://habr.com/ru/post/1382085/


All Articles