Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net Express 3.1 Calling DLL's

Status
Not open for further replies.

webrabbit

MIS
Jan 31, 2003
1,059
US
What environment variables, etc. do I have to set to access DLL's for my subprograms with standard CALL "SUBPROG" USING? They are in the same subdirectory as the EXE's. The only way I have been able to call the subprograms is to LINK the OBJ's.
 
Hi webrabbit,

Suppose you have a dll called "mydll.dll", exporting "myfunction":

In the WORKING-STORAGE SECTION:
Code:
01  MYDLL.
    03  P-MYDLL-NUM PIC 9(09) COMP-5.
    03  P-MYDLL     REDEFINES P-MYDLL-NUM
                    USAGE PROCEDURE-POINTER.

In the PROCEDURE DIVISION.
Code:
 PROCEDURE DIVISION.
 MAIN SECTION.
 MAIN000.
*    Loading the dll
     SET P-MYDLL TO ENTRY "mydll.dll".
*    Check if loading was successfull
     IF  P-MYDLL-NUM = 0
         DISPLAY "Failure loading mydll.dll"
         STOP RUN.
*    Now you can use all exported functions of mydll.dll
     CALL "myfunction" USING ... RETURNING ...

Depending on the exports of the dll, you might use a different call convention. You can find about this in the Net Express help.
Marcel
 
I know the COBOL format. When I compile the sub-program as an OBJ and link it with the main program, it works just fine. But when I compile the sub-program as a DLL, compile the main program to do dynamic calls, I get the message LOAD FAILURE ON MY-DLL.DLL.
 
Any chance MY-DLL.DLL is not in your execution path? Or are there any dependent dlls that are not in the execution path?

Regards.

Glenn
 
MY-DLL is in the same subdirectory as the main program. There are no other DLLs being called before or in MY-DLL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top