Problem:
Apartment threaded COM DLLs built with Interface Mapper not linking with multi-threaded runtime.
This is an issue in Net Express 4.0 which is resolved in Net Express 5.0.
Resolution:
Building an apartment threaded COM DLL using the Interface Mapping Toolkit, the DLL
will not be linked to use the multi-threaded COBOL runtime. This is a problem if the client program using a COM DLL is not COBOL, in which case the single-threaded runtime may get loaded.
It can also be a problem if the COM DLL code calls any other COBOL programs that are linked to
use the multi-threaded runtime.
To resolve this, there is the need to edit the deploy.mfscript file located in the NetExpress\\base\\bin directory. Scroll to the bottom of this file where to see <package name="createdll" extension="dll">. Below that, seeing <preoption>-Re</preoption> which can be changed to <preoption>-Rm</preoption>. Save the file and rebuild the COM DLL by deploying it from the Service Interfaces screen. The changed entry should be interrogated during the build and the DLL should now be linked to use the multi-threaded runtime. If this is done, it should be changed the entry in deploy.mfscript back to what it was until to build the COM DLL again. The "e" in -Re stands for "either" and means that the single-threaded or multi-threaded runtime can be used. This means that if a runtime is already loaded, it will use the loaded one, otherwise it will use the default (which is usually the single-threaded runtime unless a registry modification has been done to change the default). The "m" in -Rm means that the multi-threaded runtime should be used.



