We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
In order to call a .NET program from a native COBOL program you need to compile the C# program as a .dll that is being compiled with register as COM interop turned on. You can then use the COM support in Net Express to call the C# program as if it was a COM server.
Take a look at the article here which is for Visual COBOL but applies to Net Express as well.
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
Thanks Chris. I have the first half done for the C-Sharp program ( I found a video on youtube that explained that much of it). I'll read the article and see if it will help even though I am trying to go from unmanaged COBOL code to manged C# code. I'll let you know. Thanks again.
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
As Chris mentioned you could expose a C# dll as a COM component. If you do it this way it would be ideal that you manifest the C# COM component in your main executable if you have one, rather than registering it with regasm /codebase and save yourself DLL hell. Makes for much easier deployment and no UAC involved.
When you manifest a component you must remember that the C# also needs a manifest as activation code.
Remember if you decide to go COM you need to register an exception handler and manage those exceptions. You have to have a local working storage section for that to work.
Another option is to create a C# managed assembly with unmanaged entry points. So to COBOL this looks like a C DLL. (google RGiesecke.DllExport;) You can then in COBOL, perform a LoadLibraryA, followed by GetProcAddress, then execute the procedure. Depending on what you're passing back you might have to clean up memory with CoTaskMemFree.
I use both methods, started of using COM and then moved to C# with unmanaged entry points. The C# with unmanaged entry points became a 'gateway' type dll, where I could get the gateway to load other managed assemblies and execute methods within them, you could of course do that with the COM dll as well.
Neil
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
I just looked at the link Chris posted for the client, is not production ready as there is no exception handler, but just a good example to get you going.
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
Sounds like I can't get there from here according to the example in the article. I want to go from Net Express 3.1 COBOL (unmanaged) to a C# program that will access a url and send the results back to the COBOL program. The article was leading me to use Visual COBOL that we don't have and cannot afford that's why we have Net Express 3.1. Thanks for trying.
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
As I stated in my first reply, the article was written for Visual COBOL but it also applies to Net Express as the same COM client technology is supported in NX. In fact in this article it references a client demo program which is actually written for NX.
If you take the client program from the article and move it to a NX project you would be able to compile it and run it in order to access the COM server which in the example is written in VC but could be written in C# as well.
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
You can call Net Express 3.1 programs from c# side without COM...
What you Need is "Marshal..." then you can call from C# / VB.NET normal procedural Net Express 3.1 programs...
And you can speak via a normal Cobol "Linkage" with the Cobol program...
We have Net Express version 3.1 and i have been trying to call a C# program from a COBOL program unsuccessfully. Any help would be appreciated.
Bernd do you have a small example of how you did this : Call from C# into COBOL via normal linkage.
Regards
Neil
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.