Friday, 15 February 2013

perl - Simple Perlnet example not working with Visual Studio Express 2013, C# -



perl - Simple Perlnet example not working with Visual Studio Express 2013, C# -

i installed activestate's perl developer kit (pdk) under win 7, latest activestate community perl 64 bit. i'm trying utilize 'perlnet' tool of package, lets wrap perl code dll can utilize .net languages. so, i'm trying utilize perlnet visual studio 2013 express build nice gui in c#, perl code tied in.

but getting unusual run-time error follows. i've tried whittle downwards simplest illustration can reproduces problem. here steps do:

i have 'test_perlnet.pl' file :

use warnings; utilize strict; # putting next 'use log::report' line here (before bundle # , subroutine definition below) causes visual studio express 2013 # run time error when seek phone call 'do_some_thing()' utilize log::report; # there's nil special package; #'use'ing many other standard perl cpan packages gives run-time error # declare own bundle now: bundle test_perlnet; # declare interface stuff perlnet (the 'plc' compiler) needs integrate .dll =for interface [interface: pure] str do_some_thing(); =cut sub do_some_thing { homecoming "hello there."; } # putting 'use log::report' line here (**after** bundle # , subroutine definition above) works fine; # visual studio can see , phone call perl function 'do_some_thing()' # , "hello there." in c# button callback. #use log::report;

then create test_perlnet.dll using activestate's 'plc') "plc --force --target library test_perlnet.pl" add together generated dll c sharp project references. can invoke perl code c# button-click callback:

private void button_click_1(object sender, routedeventargs e) { test_perlnet tp = new test_perlnet(); console.writeline("message perl code: {0}", tp.do_some_thing()); }

but when click button, next visual studio 2013 express error

an unhandled exception of type 'perlruntime.perlexception' occurred in test_perlnet.dll additional information: can't locate object method "do_some_thing" via bundle "test_perlnet"

again, error if set 'use log::report;' line before bundle definition in perl code, shown above.

this problem general, since when seek exact activestate 'babelfish' illustration @ http://docs.activestate.com/pdk/8.0/perlnet_overview.html same thing happens: visual studio cannot find functions 'fish.translate()' , 'fish.languages()' though add together 'babelfish.dll'

any thought why this? dont see how can write code perl if have set 'use' statements after own subroutines. give thanks you!

c# perl visual-studio-2013

No comments:

Post a Comment