I am trying to call a method within my c# dll.
I have generated the dll and I have created the def file from that dll. That all works fine.
The problem is the COBOL implementation. I am using ACUCOBOL 10.0.1.
I am unsure how to call my dll method.
DEF-file:
>>IMP(ACU-CBLFLAGS=-Sl)
OBJECT @ASSEMBLY
NAME "@Test"
VERSION "1.0.0.0"
CULTURE "neutral"
STRONG "null"
* TestNS.ClassName
NAMESPACE "TestNS"
CLASS "ClassName"
MODULE "Test.dll"
CONSTRUCTOR, 0, @CONSTRUCTOR1
* [Class: ClassName] System.String Method1(System.String, System.String, System.String)
METHOD, 0, "@Method1"
"BSTR" @param1, TYPE 8
"BSTR" @param2, TYPE 8
"BSTR" @param3, TYPE 8
RETURNING "BSTR", TYPE 8
I loaded the def file in cobol and I have registered the dll using regasm.
COPY "TEST.DEF".
01 Call-params.
05 Param1 PIC X(12).
05 Param2 PIC X(200).
05 Param3 PIC X(100).
77 RESULT PIC X(100).
77 TEST-HANDLE HANDLE OF "@Test.TestNS.ClassName".
CREATE "@Test"
MODIFY TEST-HANDLE "@Method1" (Param1, Param2, Param3) GIVING RESULT.
I have also tried with Create "@Test" HANDLE IS TEST-HANDLE, but that gives an internal error #45, which I could not resolve.
When I try with
NAMESPACE IS "TESTNS"
CLASS-NAME IS "ClassName"
CONSTRUCTOR IS CONSTRUCTOR1()
I get undefined data-item namespace.
I seems like I can see the dll, but I cannot call the method inside it.
I don't have very much experience with COBOL yet.
I have tried to look at the samples that micro focus provides, but I can't seem to make them work for my project.
Is it possible to call a c# console application dll from cobol? if so, how do I do it?
There is no GUI. All I am doing is collecting some information (Using a .net library) and writing it to a file.
Any help is appreciated.
#AcuCobol
#C
#.net
#COBOL
#c