Call from ASP.net cobol form to dll native project

[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

  • 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.



  • 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
  • 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
  • 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.
  • 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
  • Verified Answer

    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.

  • 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
  • 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