Skip to main content

Problem:

The customer created a solution using Visual Studio .Net that contains two projects.

He had a main Console application that invoked a wrapper class in a different Assembly.

From this class, he was attempting to do a PIatform Invoke call to an unmanaged .dll developed in Net Express 4.0.

He added a reference to the unmanaged .dll in his project but when he tried to do a dynamic call at run-time to call the unmanaged .dll he received a run-time error  174  (imported file not found)

Resolution:

The problem is that when using .NET Platform Invoke from a COBOL program, you cannot call the unmanaged .dll with a dynamic call.

You must use a static CALL "progname" instead and the case of "progname" must exactly match what is used as the entry point name in the unmanaged .dll.

So if the CASE or FOLD-CALL-NAME directives are being used then you must call the program using the appropriate name that will be generated by the Net Express compiler.

A static call must be used because the .NET compiler uses the "progname" specified ito search the files which are in the projects References folder, in order to find the module which contains the "progname".

It then stores the name of the containing .dll as an external module within the .NET Assembly and the compiler generates the correct PInvoke code so that the function can be called.

Old KB# 6987