473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Calling C# DLL function from COBOL

I am getting trouble in calling a function defined in C# DLL from COBOL program.

First I want to ask whether it is possible to call a C# DLL function from a COBOL?

If anybody has done this then please help me.

Thanks in advance.

--
Rahul Anand
Nov 16 '05 #1
4 6533
On 7 Apr 2004 01:09:56 -0700, ra************@rediffmail.com (Rahul
Anand) wrote:
I am getting trouble in calling a function defined in C# DLL from COBOL program.

First I want to ask whether it is possible to call a C# DLL function from a COBOL?

If anybody has done this then please help me.

Thanks in advance.


I think the only way to cross the unmanaged->managed border is with a
COM Callable Wrapper and some sort of COM interface in your COBOL
system. I know of only two ways to call managed code (C#), this way
and from other managed code.
Nov 16 '05 #2
Brady Kelly <bk****@icom-it.co.za> wrote in message news:<ap********************************@4ax.com>. ..
I think the only way to cross the unmanaged->managed border is with a
COM Callable Wrapper and some sort of COM interface in your COBOL
system. I know of only two ways to call managed code (C#), this way
and from other managed code.

Thanks for the help. Will you provide me more details about calling a
DLL from COBOL code?

I have converted my DLL with TLBEXP tool to a COM callable wrapper.
Do I need to write COM Component wrapping the DLL function or the TLB
file can be directly called from COBOL? As I do not have any prior
COBOL programming experience, I am not sure whether it is still
feasible to do so or not?

Thanks,
Rahul Anand
Nov 16 '05 #3
Brady Kelly <bk****@icom-it.co.za> wrote in message news:<ap********************************@4ax.com>. ..
I think the only way to cross the unmanaged->managed border is with a
COM Callable Wrapper and some sort of COM interface in your COBOL
system. I know of only two ways to call managed code (C#), this way
and from other managed code.

Thanks for the help. Will you provide me more details about calling a
DLL from COBOL code?

I have converted my DLL with TLBEXP tool to a COM callable wrapper.
Do I need to write COM Component wrapping the DLL function or the TLB
file can be directly called from COBOL? As I do not have any prior
COBOL programming experience, I am not sure whether it is still
feasible to do so or not?

Thanks,
Rahul Anand
Nov 16 '05 #4
Hi Rahul

How you call a COM Module from COBOL will vary depending on what product your using

If your using MicroFocus COBOL (Net Express) then you can call a COM module by using a class control section and the invoke verb

eg

Class-Control
MyCOMClass is class "$OLE$MyCOMClass"
....
01 theCSharp object reference
....

invoke myCOMCLass "new" returning theCShar
invoke theCSharp "myMethodName" using avariabl
invoke theCSharp "finalize" returning theCSharp *> We no longer need it

Note the use if $OLE$ to denote it is a COM module

If you can move to Net Express with .Net (COBOL.Net) then you don't need any wrappers. You can just the C# Class directly

Hope this help
David

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew Wilkinson | last post by:
Hi, First off I know that in almost all cases this would be a terrible thing to do, but this is an unusual case where this makes sense. Basically I have a procedure where you pass a string...
6
by: komal | last post by:
hi all basically my problem is i have to write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function...
6
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference...
2
by: Tony Liu | last post by:
Hi, I want to get the name of the calling function of an executing function, I use the StackTrace class to do this and it seems working. However, does anyone think that there any side effect...
16
by: Saroj | last post by:
Is there an way for a function to know who called him ?
9
by: kernelxu | last post by:
hi,everybody. I calling function setbuf() to change the characteristic of standsrd input buffer. some fragment of the progrem is: (DEV-C++2.9.9.2) #include <stdio.h> #include <stdlib.h> int...
2
by: Joerg Battermann | last post by:
Hello there, I have a quick question: When calling a function B from within a function A, is it possible get information about the calling function A (e.g. name, values passed over etc) from...
2
by: sumanthsclsdc | last post by:
Hello friends, I have a problem, I implemented a class which uses tkinter and displays the window as required, the class will create a window with listbox and inserts some items into it, I...
4
by: astri | last post by:
#include "Unit1.h" #include "math.h" #include "fixed_math.hpp" #include "algorithm.h" #define MBIT 0x4000 #define CBIT 16 long constbl; void __fastcall TForm1::Button1Click(TObject...
15
by: dspfun | last post by:
Hi, Is it possible to print the function name of the calling function? For example, f1() and f2() both calls f3(), in f3() I would like to print the name of the function calling f3() which...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.