C#.NET DLL call in Progress 10.2A

dkeasberry

New Member
Hi All,

I am new to progress and need to call a .NET dll that I have created within a progress program. (*.p file)
The .NET dll has been created using VS2010.

I have tried call function with the DLL from Progress code but I get the following error message :

"Could not find entry point callFuncDmlk. (3260)"

Here is my Progress code :
Code:
PROCEDURE callFuncDmlk EXTERNAL "csgDmlk.dll" CDECL:
  DEF INPUT PARAM pVar1 AS CHAR.
  DEF INPUT PARAM pVar2 AS CHAR.
END PROCEDURE.
DEF VAR sVar1 AS CHAR.
DEF VAR sVar2 AS CHAR.

ASSIGN sVar1 = "Testing2"
           sVar2 = "HERE we are2".

RUN CallFuncDmlk (sVar1, sVar2).

Here is my C#.NET code:
Code:
namespace csgDmlk
{
    public interface icsgDmlk
    {
        void callFuncDmlk(string sVar1, string sVar2);
    }
    public class csgDmlk: icsgDmlk
    {
        public void callFuncDmlk(string sVar1, string sVar2)
        {
            string mydocpath = "C:\\temp\\Derek\\";
            string myfile = "DLLOutput.txt";
            System.IO.StreamWriter objWriter;
            objWriter = new System.IO.StreamWriter(mydocpath + myfile);
            objWriter.Write("Inputing Var1: " + sVar1);
            objWriter.Write("Inputing Var2: " + sVar2);
            objWriter.Close();
        }
    }
}

When trying to look at results from google searches I am starting to think if it is my DLL that I have created.

I used the regasm to register the DLL but it still gives me the error message stated above.
If I remove the CDECL I assume it uses STDCALL but I get the the error message:
Could not find entrypoint _callFuncDmlk@8. (3260)

I guess this is due to the function name being different in compiled DLL??

I have tried setting "Register for COM interop" in the build section (properties) within the .NET solution which gives me the *.TLB file.
I have even tried doing:

PROCEDURE callFuncDmlk EXTERNAL "csgDmlk.tlb":
DEF INPUT PARAM pVar1 AS CHAR.
DEF INPUT PARAM pVar2 AS CHAR.
END PROCEDURE.

but I get the error:
The application or DLL C:\Windows\system32\csgDmlk.tlb is not a valid Windows image. Please check this against you installation diskette.

I am stuck so please could you help me?

 

villanjj

New Member
Hi, were you able to make this work at all? I have a similar project where i need to call a c# dll (which i created) from a progress .p. Any help/direction you could provide would be deeply appreciated here.
 

dkeasberry

New Member
Hi Villanjj

I am afraid I was not able to work this out as I believe it was not possible to this with a .NET Dll. I cannot remember if i tried an old VB6 DLL. But I do remember having to do what I wanted another way as no one got back to me with this.

sorry for the bad news.
 

dkeasberry

New Member
Not a problem.

If I remember correctly I believe what I did in the end was to write an EXE which I called. This EXE encapsulated the DLL I wanted.
I think this worked.
 

medu

Member
you can't use a .net ddl that way but then there is no need to either... just put that dll in the assemblies list and use it as with any other .net or progress classes.

Code:
using csgDmlk.icsgDmlk.

def var myDmlk as icsgDmlk.

myDmlk = new icsgDmlk().
myDmlk:callFuncDmlk('toto', 'fifi').

note. i'll play a bit with the naming conventions there but guess that was just a test
 
Top