I don't know why it has to be so complicated to call a dll from acucobol :-( Anyway I now have to make a call to a dll function that will populate an array of items defined as follows.
Function Call:
Input (int64)
Output (Pointer to structure1)
Structure1
Items OutItem(10)
ItemsCount Uint8
outItem
Total Double
String1 Char(36) Null terminated string, with a buffer maximum length of 'n 1'
String2 Char(10) Null terminated string, with a buffer maximum length of 'n 1'
Here is how I defined it and make the call but of course it does not work, the dll throws a memory access violation writing to address 00000000. I'm assuming the problem is that a cobol OCCURS does not translate well to the dll's ARRAY. Any direction would be helpful...
77 WS-RETVAL PIC S9(9) COMP-5.
77 WS-NUM PIC 9(18) COMP-5.
01 WS-Structure1.
03 WS-Items OCCURS 10.
05 WS-Item-Total DOUBLE.
05 WS-Item-Str1 PIC X(37).
05 WS-Item-Str2 PIC X(11).
03 WS-ItemsCount PIC X(1) COMP-N.
PERFORM VARYING CTR FROM 1 BY 1 UNTIL CTR > 10
MOVE ZEROS TO WS-Item-Total
MOVE LOW-VALUES TO WS-Item-Str1(CTR)(37:1)
MOVE LOW-VALUES TO WS-Item-Str1(CTR)(11:1)
END-PERFORM.
MOVE ZEROS TO WS-ItemsCount.
CALL "Lib.dll@WINAPI".
CALL "Function"
USING BY VALUE WS-NUM
BY REFERENCE WS-Structure1
GIVING WS-RETVAL
END-CALL.
CANCEL "Lib.dll@WINAPI".



