Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
frand1 Super Contributor.
Super Contributor.
1920 views

C# calling NE cobol

Hi,

I am trying to get a C# app to call a Netexpress Cobol DLL.  I have changed the dir in the C# to point at where the DLL is, but still when I run the C#, I and get the point that it calls the cobol, I get:

Unable to load DLL 'C:\MPIUADEV\MPIUA\DEV\COBOL\mbaprate.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

which I take to mean that the DLL can't be found.  I also added C:\MPIUADEV\MPIUA\DEV\COBOL to the path.

I am wondering if I created the DLL incorrectly.

Tags (3)
0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

RE: C# calling NE cobol

The error you are receiving could mean that it cannot find one of the dependencies of the NX .dll like the run-time system.

If you are trying to P/Invoke this native .dll from a C# program then you should make sure that the .dll is linked with the dynamic option so that it can find the required run-time system cblrtss.dll, if you have the Server for COBOL product installed on the system. If you do not have Server for COBOL installed then you will need to ensure that cblrtss.dll and other dependencies are available within the PATH.

Thanks.

0 Likes
frand1 Super Contributor.
Super Contributor.

RE: C# calling NE cobol

Hi Chris,

This is some of what I have set:

set aslmfnet=\\orcl\I-drive\Micro Focus\mfaslmf

set COBDIR = \\orcl\I-drive\Micro Focus\Server 5.1\Bin;

set path=\\orcl\I-drive\Micro Focus\Server 5.1\Bin;%path%;

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: C# calling NE cobol

Hello,

I'm not sure if this is the cause of the problem, but there are spaces in your PATH. You might want to quote the UNC.

Regards,

–Ғɑɳօ
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: C# calling NE cobol

There may be a permissions problem trying to load the .dlls from a network drive. To test this, move the run-time file, either cblrtss.dll or cblrtsm.dll if multi-threaded to your local drive in the same location as your unmanaged dll and see if it can then load.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.