16

I realize that I have to DllImport the perlembed methods

perl_parse
perl_alloc
perl_free

etc.,

But not sure how to marhsall the function arguments for using it with DLLImport especially with perl_parse method.

I also realize that a related question already exists which is almost there but still the OP has solved by created a C wrapper and then using it in C#.

He says that he was not able to DLLimport PERL_SYS_INIT3.

So my question is how to properly wrap them using only C# and use it?

Community
  • 1
  • 1
Vivek Bernard
  • 2,063
  • 3
  • 26
  • 43

1 Answers1

2

Look at this; I hope it will help (it was called in early version)

I got this from here (perl)

To embed a Perl interpreter in a C# program, add a reference to the COM object "Microsoft Script Control 1.0" and write code like this:

MSScriptControl.ScriptControlClass Interpreter;
Interpreter = new MSScriptControl.ScriptControlClass();
Interpreter.Language = @"PerlScript";
string Program = @"reverse 'abcde'";
string Results = (string)Interpreter.Eval(Program);

The above is equivalent to the following Perl script, which embeds a Perl interpreter within a Perl interpreter:

use Win32::OLE;
my $Interpreter;
$Interpreter = Win32::OLE->new('ScriptControl');
$Interpreter->{Language} = 'PerlScript';
my $Program = "reverse 'abcde'";
my $Results = $Interpreter->Eval($Program);
Beska
  • 12,445
  • 14
  • 77
  • 112
Likurg
  • 2,742
  • 17
  • 22
  • 1
    That will work only if you have Active State Perl installed with the PerlScript feature. If you have a different Perl (e.g. you compiled Perl from source) you don't have PerlScript installed in the system. – Francisco Zarabozo Aug 30 '13 at 23:19