1

I've created a working example calling a C# DLL from ActivePerl using Win32::OLE. However, as expected out parameters on the C# side are not updated on the perl side, but also 'complex' types (such as List<int> instead of int[]) do not work.

While I can probably stick to the basics of int, string, and arrays of such, is there a way to return these complex types to perl apart from serialising as a string? At the moment, an attempt to return List<int> as below simply results in an undefined variable.

perl

use Win32::OLE;
Win32::OLE->Option(Warn => 3); # to check I'm not missing any exceptions

my $dll = Win32::OLE->new('TestDLL.TestClass');
my $result = $dll->GetIntList(); # $result is undef

C#

public List<int> GetIntList()
{
    return  new List<int>() { 1, 2, 3 };
}

I've also added debugging statements to the above in C# to confirm it is called and the list has 3 members before returning.

Nick P
  • 759
  • 5
  • 20

0 Answers0