473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6574
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$MyCOMClas s"
....
01 theCSharp object reference
....

invoke myCOMCLass "new" returning theCShar
invoke theCSharp "myMethodNa me" 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
2165
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 containting a template for a tuple, the function then finds a tuple that matches this template and then returns it. The template may contain variable names, which match against anything in that position in the tuple - this is all working fine,...
6
1971
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 parameter.and no of parameter is calling function can be anything. for example.suppose my function is function2. then when i call function1(int i ,char j,float d) { function2()
6
3315
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 in VBA from my other Access applications. This works fine and I'm quite happy with it... except for one area; error handling. In most of my functions I call an error handler which
2
9786
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 towards this approach such as how would it works in multi-thread. Thanks Tony
16
2041
by: Saroj | last post by:
Is there an way for a function to know who called him ?
9
4014
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 main(void) { char buf = {0};
2
1325
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 within the function B? The reason why I am asking, is, for example when handling exceptions or logging errors so I know what exactly happened.
2
2791
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 created the instance of this class and executed, I require the selected item to be sent back to the calling function, and the window should not be destroyed. When the button is pressed I require the control to get back to calling function and process...
4
10652
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 *Sender)
15
22872
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 could either be f1() or f2(). BRs!
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.