| Store | Cart

AW: C#, Perl and COM objects (PerlNET / Win32::OLE)

From: Miriam Heinz <miri...@itk-austria.com>
Wed, 28 Oct 2015 11:45:12 +0100
> Rob (2015-10-23, sisy...@optusnet.com.au):  > This is a very inactive list, and you may well get no helpful response to> your request. 

thank you for the information regarding this mailing list.
I thought I'd start here, as this seems to be a problem closely related to
the inner workings of PerlNET (-> ActiveState).

> Rob (2015-10-23, sisy...@optusnet.com.au):  > That being the case, I would suggest posting to perlmonks (   > http://www.perlmonks.org/?node=Seekers%20of%20Perl%20Wisdom ).  > Another option might be a post to stackoverflow   > http://stackoverflow.com/) - which is a forum I haven't tried, but one
that   
> seems to be fairly well attended.> Jason (2015-10-23, kirk...@hotmail.com):  >To that end, if you do post the question elsewhere would you post a link to
your post back here.  I would like to read the resolution.

I now added some details to my question at the community site:  
http://community.activestate.com/node/18247

And additionally posted my question to both PerlMonks and StackOverflow   
- since I'm not quite sure if this is more a perl or C#/.NET question:  
PerlMonks: 
http://www.perlmonks.org/?node_id=1146244  
StackOverflow: 
http://stackoverflow.com/questions/33388853/passing-a-com-object-from-c-shar
p-to-perl-using-perlnet

---
Some further details:

In the meantime I discovered that I can invoke methods on the passed COM
(`$obj`) object by using `InvokeMember` of ` System.Type ` which I initially
thought didn't work.

It does work if I specify *exactly* which overload I want to use and which
types I'm passing:

    use PerlNET qw(typeof);

    typeof($obj)->InvokeMember("Xyz", 
        PerlNET::enum("System.Reflection.BindingFlags.InvokeMethod"), 
        PerlNET::null("System.Reflection.Binder"), 
        $obj, 
        "System.Object[]"->new());


Using this approach would mean rewriting the whole wrapped perl module. And
using this syntax..

Now I am wondering if I am losing both the advantages of the dynamic keyword
in .NET 4.0 and the dynamic characteristics of perl (with Win32::OLE) by
using PerlNET with COM objects.

It seems like my preferred solution boils down to some way of mimicking the
behaviour of the `dynamic` keyword in C#/.NET 4.0.  
Or finding some way of converting the passed COM object to something that
will be recognized as compatible with Win32::OLE.

Thanks again,
Miriam

_______________________________________________
Perl-Win32-Users mailing list
Perl...@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Recent Messages in this Thread
Jason Kirkwood Oct 23, 2015 07:38 pm
Miriam Heinz Oct 28, 2015 10:45 am
Messages in this thread