How to invoke a C# DLL function from powerbuilder 12.5 with a structure object as input parameter

1.4k Views Asked by At

I have developed a C# class in Visual Studio 2012 and registered the DLL. The class has two methods ( method1 and method2 )

I am trying to call from PB12.5 the method one as ( webservice is the name under which the class is registered )

lnv = CREATE OLEObject  
lnv.ConnectToNewObject("webservice");
ls_ret = lnv.GetPayerId(pcreatepayidinrec)

where pcreatepayidinrec is a structure object in PB. Then I get "error calling external object function ..."

I believe that the issue is how to pass the input parameter when invoking the function, as when I try with simple ( ie string ) parameter, it works fine

Any assistance is kindly appreciated

Thanx J

1

There are 1 best solutions below

1
On

You should be able to use the structure just fine. I have never used "ConnectToObject" when using .NET controls in a newer PB program and it seems like the more challenging way to go-- but I might be misunderstanding something. If you specify the DLL as a reference and put it in the "USING" section for your PB object you don't need to use it like an OLE server. Sorry if I lead you astray.

I have a very simple example of a WCF web service that I created in PowerBuilder and consumed in .NET using an array of structure that might help you. One of these is a beginner, and others I expanded on to make more complex variations hope they help.

DisplacedGuy - Creating PowerBuilder 12.5 WCF Service consuming via ASP.NET MVC4 Application DisplacedGuy - My First WCF Service using PowerBuilder 12.5 .NET

There is another one or two on the site but these seems to be more popular, hth.

Rich