Just a simple try for studying COM(Component Object Model).
The original article is here.
And we could find the original codebase here or another changed version here.
I made some adjustments so that we could use cmake to compile this project.
Take it easy to study COM and have fun!
First, you can use midl.exe to compile IAdd.idl file,
midl.exe .\IAdd.idlthen, you can run powershell script to compile these source files,
.\lcompile.ps1then, we need to register our dll file generated during last step,
regsvr32.exe .\build64\Debug\AddObj.dllnote: here we need run register32 command in Administrator mode, you can simply use scoop tu install gsudo and run sudo to enter Administrator mode.
then, cd test, and run lcompile.ps1, then, execute the exe file,
.\build64\Debug\comtest.exeoutput:
Output after adding 100 & 200 is 300.