Getting RTS 173 error when calling native .dll from a managed .NET application
A .NET managed code application such as Windows Forms or WCF is trying to call a program which resides in a native code .dll. The program being called has the same name as the .dll and it is available in the current folder of the managed code application.
When the call is made an RTS 173 error occurs stating that the program cannot be found.
What could cause this?
There are a couple things that could cause the 173 error. The most common are:
1. The case of the program name in the call statement does not match that of the entry point name. If you do not specify the $SET CASE directive within the native program then the default is to convert the program-id to upper-case. If this is true then the call statement needs to use upper-case as well. If you do specify the CASE directive then it will generate the entry point name exactly as it is specified in the program-id.
2. The native .dll is not linked as dynamic and the run-time system cblrtsm.dll is not available within the PATH. The 173 error can mean that either the program being called cannot be found or one of it's dependencies cannot be found. Since a native .dll is dependent on the run-time system then cblrtsm.dll must be available when the program is called. That means that the native .dll should either be linked using the dynamic option so that the Windows registry will be used to find the run-time or you must set the PATH to include the location of cblrtsm.dll prior to running your application.