Groups | Blog | Home
all groups > dotnet interop > september 2006 >

dotnet interop : Can't access COBOL DLL from C# program


Parrot
9/1/2006 3:10:02 PM
I cannot get my C# program to access a DLL program written in COBOL. I use
the following code to represent the program:

[DllImport("readmf.dll")]
public static extern void CYREAD(string linkfile, linkdata ld);

I use the following statement
CYREAD(linkfile, ld)
and it said that the program readmf.dll cannot be found even though I have the
DLL in my bin, debug, and root directory along with the .LIB file. I then
tried
to add a reference to it but when I clicked on the DLL to add it I receive a
message that says the file could not be added. I was able to access a COBOL
Parrot
9/2/2006 6:14:01 PM
Hi Mattias;
Thanks for your reply. I did place the DLL program in the Windoows/System32
directory and it still gave me the message that it can't find the program.
Anyplace else I should put it?
Dave Uphoff

[quoted text, click to view]
Mattias Sjögren
9/3/2006 12:00:00 AM

[quoted text, click to view]

Have you tried placing it in the Windows System directory?


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Scott M.
9/4/2006 4:17:32 PM
I don't think it is a matter of where the COBOL dll is. You need a RCW
(runtime callable wrapper) and VS.NET usually creates this automatically for
you when you make a reference to a COM component. Now, I don't have a lot
of experience in COBOL, but aren't COBOL files host files (and not COM
components)?

So, if that is the case, you would need some translation or gateway
component to bridge the gap between your .NET code and your COBOL code.



[quoted text, click to view]

AddThis Social Bookmark Button