[Migrated content. Thread originally posted on 30 June 2009]
Hi all,I want to share with you some useful information about how execute a COBOL app that interoperates with .NET with 8.1 runtime.
As this is a common setup for most of our customer, this can be of interest to many of you.
We begin from the deployment of the VC CRT and VC MFC as shared assemblies
(this should be common yet), note the 2 folders Microsoft.VC80.CRT and Microsoft.VC80.MFC.
Then to interoperate with .NET we need also AcuToNet.dll and Marshal.exe.
AcuToNet.dll is a .NET assembly that need to be registered for COM interoperability
by the RegAsm.exe utility (that is present in the .Net Framework installation
directory).
The problem is that you can't normally register an assembly on a network
share that is not strong typed. So we need to alter the system privileges
with CASPOL.EXE (that one comes in .NET Framework too), trusting only AcuToNet.DLL.
After you have executed CASPOL.EXE, you can finally register AcuToNet.dll
and Marshal.exe (the latter is needed to pass the data back from .NET to
COBOL).
Here you can see the full session:
Z:\\ldevoti\\public\\studioFarma\\bin>dir
Il volume nell'unit? Z ? Data1
Numero di serie del volume: D863-CFC9
Directory di Z:\\ldevoti\\public\\studioFarma\\bin
25/06/2009 11.00 .
25/06/2009 11.00 ..
28/11/2008 19.35 147.456 aclnt.dll
28/11/2008 19.35 339.968 acme.dll
25/06/2009 10.57 28.672 AcuToNet.dll
22/09/2008 10.36 225.280 ajpg32.dll
28/11/2008 19.35 884.736 atermmgr.dll
28/11/2008 19.36 245.760 avision5.dll
28/11/2008 19.36 81.920 axml32.dll
28/11/2008 19.35 196.608 libexpat.dll
22/09/2008 12.30 94.208 Marshal.exe
20/05/2009 11.23 Microsoft.VC80.CRT
20/05/2009 11.23 Microsoft.VC80.MFC
20/04/2009 09.11 16.384 myHMACSHA1.dll
23/09/2005 07.28 53.248 RegAsm20Acu.exe
20/04/2009 09.12 20.480 WindowsApplication1.exe
18/01/2008 17.39 429 wrun32.3lc
28/11/2008 19.46 1.482.752 wrun32.dll
28/11/2008 19.36 122.880 wrun32.exe
28/11/2008 19.34 73.728 zlib.dll
16 File 4.047.277 byte
4 Directory 37.721.026.560 byte disponibili
Z:\\ldevoti\\public\\studioFarma\\bin>c:\\windows\\Microsoft.NET\\Framework\\v2.0.50727\\caspol
-m -ag 1.2 -url file://z:\\ldevoti\\public\\studioFarma\\bin\\AcuToNet.dll FullTrust
Microsoft (R) .NET Framework CasPol 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
y
Added union code group with "-url" membership condition to the Machine level.
Success
Z:\\ldevoti\\public\\studioFarma\\bin>c:\\windows\\Microsoft.NET\\Framework\\v2.0.50727\\RegAsm.exe
/tlb /codebase AcuToNet.dll
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.
Types registered successfully
Assembly exported to 'Z:\\ldevoti\\public\\studioFarma\\bin\\AcuToNet.tlb', and
the type library was registered successfully
Z:\\ldevoti\\public\\studioFarma\\bin>Marshal.exe /RegServer
Z:\\ldevoti\\public\\studioFarma\\bin>cd ..
Z:\\ldevoti\\public\\studioFarma>lancia
Z:\\ldevoti\\public\\studioFarma>.\\bin\\wrun32.exe -c c -d program1
Hope this is useful
best regards,
Luca Devoti



