Sorry to resurrect this thread but I’ve got a very odd problem.
My server does the above with the uROComInit file and runs without problems. However I’ve now created a Delphi DLL which is statically linked into this server application so it loads at runtime.
The problem I’m getting is that I get the above “CoInitialize has not been called” exception within my server, even though no calls have been made to the DLL at all. Simply removing the DLL cures the problem.
The DLL does call CoInitialize(NIL) itself but I tried removing that to no avail. I then tried adding the uROComInit file as the first file in the DLL’s uses clause but, when I do that, the application seizes up when I run it and I have to kill it via task manager.
I seem to have fixed it for now by changing from static to delayed binding. Obviously doing it this way, by the time the DLL loads, the main app has properly initialised whereas, with static binding, it’s loading the DLL before the main app has initialised something or other which is what seems to be causing the problem.