Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Registering a COM object with only an IDL file

I have a third-party IDL file which, when compiled, generates a header and an _i.c file. All three of these files are part of a Visual Studio 2010 project. (So far the project is empty other than attempted COM initialization stuff.)

I can get the project to compile by calling

CoInitialize(NULL);
CoCreateInstance(stuff);

At runtime CoCreateInstance() returns a "Class not registered" error.

Everything I can find on the Internet says to register a COM object by running regsvr32 on the DLL file or EXE file. However I only have an IDL file. I tried registering the EXE file generated by the project, but I got an error saying the module was "loaded but the entry-point DLLRegisterServer was not found."

I'm honestly not sure what else to try.

like image 210
Ash Avatar asked Oct 22 '25 21:10

Ash


2 Answers

IDL files define interfaces, not implementations. If literally all you have of this third-party component is an IDL file then you have nothing you could register.

It's possible that the IDL file describes interfaces you're to implement that third-party code calls into; in that case you wouldn't CoCreateInstance them, they might CoCreateInstance you. But given the amount of information, I'm leaning towards you're missing the actual third-party component or you're passing the wrong thing to CoCreateInstance.

like image 66
Logan Capaldo Avatar answered Oct 25 '25 12:10

Logan Capaldo


An IDL File (Interface Definition File) does not provide any implementation for the types declered on it; it only specifies how you can communicate with classes coded in a DLL that implements the IDL file.

The IDL file is not enough, you will also need the DLL that implements it.

like image 39
yms Avatar answered Oct 25 '25 12:10

yms



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!