1. sachidhanantham ramalingam
  2. PowerBuilder
  3. Wednesday, 12 July 2023 11:34 AM UTC

Hi,

Am using PB 2019 R3, planning to consume .NET dll using OLE Object in PB,
.NET dll will be created using COM interop enabled and build using .net 6 core (VS 2022) - Is it possible to consume it in PB?,

since i can see one of the appeon forum for .net dll support,
https://docs.appeon.com/pb2021/application_techniques/Calling_C_Assembly_in_an_Application.html

Note: I have already consumed .NET dll in PB successfully (which was created using Target Framework 4.5 (VS2019)).

Thanks,
--Sachi...

Who is viewing this page
sachidhanantham ramalingam Accepted Answer Pending Moderation
  1. Tuesday, 18 July 2023 09:10 AM UTC
  2. PowerBuilder
  3. # 1

Hi,

Another query, is it possible to pass a structure variable (as one of the argument) to .Net dll function from PB, if so then how do i read that structure in c# .Net dll.
Do we have any other option to pass dataset to .Net dll function?

Note: As i mentioned earlier, am using OLE Object for calling c# .net dll function in PB.

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 18 July 2023 14:49 PM UTC
Hi Sachi;

Absolutely - as long as the structure contains "simple" data types.

Regards ... Chris
  1. Helpful
  1. sachidhanantham ramalingam
  2. Wednesday, 19 July 2023 07:10 AM UTC
Thanks Chris,

If i pass the structure then how do i receive it C#, do you have any example?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 19 July 2023 14:02 PM UTC
You would define a comparable structure in C# and then accept it at run time by REF (as a pointer).

https://www.tutorialspoint.com/csharp/csharp_struct.htm

  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 12 July 2023 12:54 PM UTC
  2. PowerBuilder
  3. # 2

Be aware that creating com interop in .net 6 isn't so easy (but I think it's still possible). That's because .net 6 support other OS beside windows. But COM Interop is only supported in windows, so related options are removed when using .net 6.

Andreas.

Comment
  1. Andreas Mykonios
  2. Monday, 17 July 2023 10:36 AM UTC
Hi Miguel. Take a look to the following case in technical support: https://www.appeon.com/standardsupport/search/view?id=10354. Seems that you still can use .net framework dll's in PB 2022 R2.

Andreas.
  1. Helpful 2
  1. Miguel Leeuwe
  2. Monday, 17 July 2023 11:19 AM UTC
I'll have a look, thank you Andreas!
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 18 July 2023 09:21 AM UTC
Hi Andreas,

I've done the test. It all still works!!! Have commented on the link and Peter Pang says they'll update the documentation.

regards
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 12 July 2023 12:09 PM UTC
  2. PowerBuilder
  3. # 3

If all the .Net stuff is non visual, you don't have to compile as COM visible. You can then indeed use the DLL importer tool. Also you won't need to use OLE, you can simply call the functions generated by the DLL importer tool.

Note: not all parameter variable types are compatible, so you might have to write some .net functions that take standard parameter input and then call your function with whichever datatypes you might need.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.