MicroFocus calls to third party DLL's 
Author Message
 MicroFocus calls to third party DLL's

Does anyone happen to have a code sample showing how to call a third
party DLL?  I got an example of the dll call from the MF home page, but
it called an OS/2 dll, which I suspect works differently.  Basically, I
have a DLL with 10 functions contained in it.  I wish to invoke these
functions using MF COBOL, passing the correct parameters.  I am on
version 4.0.26, running under win NT4.0

Thanx for your assistance,

Mark McNary
systems analyst, MCI Communications



Sun, 06 Feb 2000 03:00:00 GMT  
 MicroFocus calls to third party DLL's

Quote:

> Does anyone happen to have a code sample showing how to call a third
> party DLL?  I got an example of the dll call from the MF home page, but
> it called an OS/2 dll, which I suspect works differently.  Basically, I
> have a DLL with 10 functions contained in it.  I wish to invoke these
> functions using MF COBOL, passing the correct parameters.  I am on
> version 4.0.26, running under win NT4.0

> Thanx for your assistance,

> Mark McNary
> systems analyst, MCI Communications


Actually calling a function in a DLL should work basically the same in
NT and OS/2. When you link your program you will have to link in the LIB
that contains the function calls that you are interested in. If I recall
correctly some of the MF samples used DOSCALLS, so the link step had to
link in DOSCALLS.LIB.  

If you are using the CBLLINK facility under NT use the verbose option
(-V) to see the exact linker syntax.
--
Return address is John underscore Saxton at ML dot com



Tue, 08 Feb 2000 03:00:00 GMT  
 MicroFocus calls to third party DLL's

Quote:

> Does anyone happen to have a code sample showing how to call a third
> party DLL?  I got an example of the dll call from the MF home page,
> but
> it called an OS/2 dll, which I suspect works differently.  Basically,
> I
> have a DLL with 10 functions contained in it.  I wish to invoke these
> functions using MF COBOL, passing the correct parameters.  I am on
> version 4.0.26, running under win NT4.0

> Thanx for your assistance,

> Mark McNary
> systems analyst, MCI Communications


One way that works(snip from testprog)

#define MYCOBLIB    "cobfunc.dll"

typedef FARPROC (*CobEntry)( BYTE * );

// Valid entry point names in above DLL
#define COB_REVERSE_STRING "cob_reverse_string"
............................

void testfunc()
{
    BYTE Astring[30];
    CobEntry cobentry;

    HCobDLL = LoadLibrary(MYCOBLIB);

     if (!HCobDLL)
     {
      printf("\n Failed to load %s", MYCOBLIB);
      exit(-1);
     }
     cobentry =  (CobEntry)GetProcAddress(HCobDLL, COB_REVERSE_STRING);
     if (cobentry)
    {
      printf("\n**** Test %s ****", COB_REVERSE_STRING);
      strcpy(Astring,"Input");
      printf("\n Input.: %s",Astring);
      Astring[30] = 0x00;
      cobentry(Astring);
      printf("\n Output: %s",Astring);
     }
     else
    {
      printf("\n Failed to get address of entry %s",
COB_REVERSE_STRING);
     }

Quote:
}

I find it quite easy to mix Visual C/C++ and MF Cobol in NT 4.0..
When your C/C++ prog loads your Cobol DLL, the run-time (MFRTS32.DLL)
also loads...
From then on  you can call .GNT or .INT from entry-points in your Cobol
DLL..
You can also typecast and set function pointers in your C/C++ code and
pass them to your Cobol
progs..
Then you can CALL the pointer directly in a sub-program in Cobol (This
is just much more pretty in Cobol!!)
I use this for tracing back to a NT Service I have written...

Regards

Geir Knaplund
"Chief Nerd"
Provida ASA



Wed, 09 Feb 2000 03:00:00 GMT  
 MicroFocus calls to third party DLL's


Quote:

> > Does anyone happen to have a code sample showing how to call a third

> > party DLL?  I got an example of the dll call from the MF home page,
> but
> > it called an OS/2 dll, which I suspect works differently.
> Basically, I
> > have a DLL with 10 functions contained in it.  I wish to invoke
> these
> > functions using MF COBOL, passing the correct parameters.  I am on
> > version 4.0.26, running under win NT4.0

> > Thanx for your assistance,

> > Mark McNary
> > systems analyst, MCI Communications

> Actually calling a function in a DLL should work basically the same in

> NT and OS/2. When you link your program you will have to link in the
> LIB
> that contains the function calls that you are interested in. If I
> recall
> correctly some of the MF samples used DOSCALLS, so the link step had
> to
> link in DOSCALLS.LIB.

> If you are using the CBLLINK facility under NT use the verbose option
> (-V) to see the exact linker syntax.
> --
> Return address is John underscore Saxton at ML dot com

See my other posting to this thread...

Yes it works the same both in OS/2 and NT.. (The API is a little
different)
It is the closest to a dynamic call in C/C++
(LoadModule/GetProcAddress)..

Regards
Geir Knaplund



Wed, 09 Feb 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Call to Third Party Template Authors

2. Call for third party support

3. Instal Shield and clarion and 3rd party DLL's

4. Microfocus dll called from Java eats memory

5. C calling MicroFocus DLL

6. Calling a VB5 DLL from Microfocus COBOL

7. Calling Windows DLL from MicroFocus Cobol

8. Microfocus calling DLLs

9. FroCoS'2000: Third Call for Papers

10. FroCoS'2000: Third Call for Papers

11. Third Parties

12. Third party software: Smalltalk / Java

 

 
Powered by phpBB® Forum Software