ASP.NET application gets RTS error 174 - "Imported File not found" when calling unmanaged COBOL .dll
Customer has created an ASP.NET Web Application in Visual COBOL which needs to do a P/Invoke call to an unmanaged COBOL program by using the following code:
01 pp procedure-pointer.
01 next-prog pic x(20) value "myentry".
set pp to entry "DECHANGE"
This works fine if the program is debugged using the Visual Studio interner Development Web Server but when the Web Server is changed to use Local IIS instead the following error message is displayed when executing the set pp to entry ... statement:
This error occurs because when running under IIS you must link the unmanaged COBOL .dll as dynamic instead of Shared on the COBOL Link option tab of the Project Properties page.
This is because the search mechanism for the COBOL run-time system cblrtsm.dll is different when run under IIS. The error occurs because the run-time system cannot be found.
When linking the program as Dynamic it will use the Visual COBOL registry settings in order to locate the COBOL run-time system instead of requiring it to be within the system PATH.