tags:

views:

346

answers:

2

Does anyone know if it's possible to call a Perl sub from Mono in C#? This is on a Linux machine.

Maybe DllImport? We want to avoid loading perl every time if possible, as well.

+3  A: 

This thread on PerlMonks might help.

Sinan Ünür
This post suggests they haven't tried it on Linux, has anyone tried it? I am wondering if the Microsoft COM object they use in the example even works on Linux.We will try it, just wondering if anyone has already.
Jonathan.Peppers
@Jonathan the COM object does not even exist on Linux. You did not mention Linux in your question. Maybe you should update to clarify.
Sinan Ünür
I was expect the mention of Mono would make one assume I'm referring to Linux.
Jonathan.Peppers
@Jonathan Why??? http://mono-project.com/skins/Mono2/images/home-download-mono.png
Sinan Ünür
Which OS is listed first on your pic? If I were a betting man, and someone mentioned mono. I would bet they were running it on Linux. Why run Mono on Windows when the .Net framework is fully available?
Jonathan.Peppers
Mono is available on all three platforms. I work mostly on Windows and I am using Mono to learn C#. Your expectation that the mention of Mono should imply that you are on Linux is similar to an assumption that the mention of `gcc` should imply Linux. Neither is warranted. This, of course, is not a big deal, but methinks you are being a little too persistent with this.
Sinan Ünür
+3  A: 

Interop works fine with Mono under Linux to call C-Code. Thus I would consider that you look at perlembed. Instead of a C-program you need to create a shared C-library. For Interop there are several good guides - a potential pitfall are sizes of datatypes, because you get really plaform/CPU dependent. Let me know if you need anywhere more detailed information.

weismat
This will definitely get me rolling. I will probably post back if are any pitfalls.
Jonathan.Peppers