CptSkripto has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all,

I am currently researching solutions to a project that involves the collection of images from a MJPEG stream, their decompression to DIB, a series of semi-complex operations on the image bits, and finally their compression back to jpeg.
For performance reason, the decompression, manipulation and compression operations are performed via the IPP (Intel Performance Primitives) library. I have not been able to use the aforementioned library in perl and have therefore written that portion in C#.
Here comes the real question. While I have to perform the IPP related portion in c# (sort of) I would like not to abandon completely the perl portions written through the years. I am therefore seeking your wisdom about the best way to exchange data "efficiently" (read in memory) across different processes written in different languages.
Currently, because I am developing in Win32, I can write a dotNET wrapper to the Win32::MMF through the Activestate PerlNet or access the Memory mapped Files via P/Invoke in C#. Ideally I would like to find a solution to this communication problem not linked to a specific "product" (Perlnet) and possibly cross-platform (Mono and Perl).

Thank you in advance for your insights.

Yours truly,

Cpt. Skripto
  • Comment on Inter Process/Inter Language Communication

Replies are listed 'Best First'.
Re: Inter Process/Inter Language Communication
by zentara (Cardinal) on Nov 24, 2008 at 18:30 UTC
    I don't use win32, but it might be helpful if you would detail what sort of program the c# is,( for example: an executable that takes a file as input and delivers it processed to stdout? )

    If that is the case, you can probably use a Perl IPC module, like IPC::Run , IPC::Open3, etc. Read "perldoc perlipc" for the general idea. You open your program thru pipes or sockets, send it input, and collect output. The key issue is how the c# program handles input/output.... can it take data on stdin or only filenames, etc...does it output to stdout or 2 a file, etc. The other problem is pipes on win32 can be tricky, and you may need a win32 module if using a piped method. IPC::Run uses sockets though, and is generally used on win32, so you might want to look in that direction.


    I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: Inter Process/Inter Language Communication
by Bloodnok (Vicar) on Nov 24, 2008 at 18:01 UTC
    ...sounds like a job for XS, SWIG or even possibly Win32::OLE.

    As I've mentioned elsewhere (http://perlmonks.org/?node_id=724251), you might also want to have a look @ Dave Roths web site for Win32 stuff.

    A user level that continues to overstate my experience :-))