Highlighted
Absent Member.
Absent Member.
3323 views

Call from ASP.net cobol form to dll native project

Jump to solution

[Migrated content. Thread originally posted on 31 January 2012]

Hello I could not call dll native cobol from asp.net, the dll exists but the asp.net cobol program does not find it, I used asp.net with windows .net class link in order to link dll native, asp.net works well with .net windows program but I have te same problem because I can not link .net windows program with dll native in this solution, the dll exists and compile but it does not work.

Thanks for your help

Francisco Zambrano

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Add the following directive to the top of Nativo.cbl

$SET CASE

The default without this directive is to convert the entry point name to uppercase so:
CALL "Nativo" ...
would fail but
CALL "NATIVO" would work because this is the actual name of the entry point.

Setting the CASE directive prevents external symbols (such as Program-ID and names of called programs) from being converted to uppercase.

View solution in original post

0 Likes
9 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Call from ASP.net cobol form to dll native project

Jump to solution
When doing a Platform Invoke (P/Invoke) from a managed code application to an unmanaged native .dll, the native .dll should be placed into the same bin folder where the calling .exe resides.

You can do this by making the output folder of the native project to point to the same location as the bin folder of the main project.

If the name of the .dll is different than the name of the entry point that you are calling then you need to load the .dll first. You can do this by using a procedure-pointer as follows:

01 proc-pointer procedure-pointer.
procedure division.

set proc-pointer to entry "mydll"
call "nativeentry" using...

Also, in order for the ASP.NET program to be able to find the native .dll you may also need to add its location to your system PATH using Control Panel-->System-->Advanced-->Environment Variables. After doing this you will either need to restart IIS, under Windows XP or reboot the computer under Windows 7 in order for IIS to pick up the changed variable.

Thanks.



0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Thank you for your answer, but I have a problem My solution have a web site, managed cobol program and native cobol program, the web site access the managed cobol program as dll ok, but when te managed try to access native dll from managed cobol program I receive the following error in the stack

[EntryPointNotFoundException: No se puede encontrar el punto de entrada denominado 'Nativo' en el archivo DLL 'Nativo.dll'.]
Nativo(IntPtr A_0) +0
Intermedio.Intermedio(Reference Mensaje) in C:\Cobol\francisco\Webdll-1\Intermedio\Intermedio.cbl:11
_Default.btnBoton_Click(Object lnkSender, EventArgs lnkEvent) +231
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

Thank you
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Hello, I have the following facts

managed with native works ok
web site with managed works ok

but website with access managed and managed access native not work. give the error

Thanks
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Call from ASP.net cobol form to dll native project

Jump to solution
The error that we need to address is the following:

[EntryPointNotFoundException: No se puede encontrar el punto de entrada denominado 'Nativo' en el archivo DLL 'Nativo.dll'.]

What does your call statement look like?

What is the name of the source file that is being compiled into Nativo.dll, is it Nativo.cbl or something else?
Are you specifying the CASE directive on the native program?

Does Nativo.dll exist in the bin folder of the web site?
Is the web sites bin folder in the system PATH?

Is your web site running on the local file system using Visual Studio's web server or is it running under IIS?

Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Hello, thanks you for your answer, I send to you the links that looks like the solution:

application running
Nativo.cbl
Intermedio.cbl
Defaut.aspx.cbl
Default.aspx
path description

I believe that you have all information that you need

Thanks
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Add the following directive to the top of Nativo.cbl

$SET CASE

The default without this directive is to convert the entry point name to uppercase so:
CALL "Nativo" ...
would fail but
CALL "NATIVO" would work because this is the actual name of the entry point.

Setting the CASE directive prevents external symbols (such as Program-ID and names of called programs) from being converted to uppercase.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Thank you, it works ok
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Hello, now I built solution with web site and Native cobol dll only but I receive the next error when I try to add reference to web site:

add reference error

I included several links in order to see the solution

aspx page
aspx.cbl
Nativo.cbl
path definition

if you need more information please ask me it

Thank you for your help
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Call from ASP.net cobol form to dll native project

Jump to solution
Hello, the problem was in the path environment variable because I had a variable pointing another dll, the solution is working well

All tests is in order to work with RMcobol and web sites, I don´t know how say to the solution that the environment is RMcobol

In the article in Micro focus community, define environment variable for RMcobol but I don´t know How set this variable in the web site.

Thanks
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.