EV/libev with Inline::C in perl

Ryan Bullock rrb3942 at gmail.com
Sun Oct 2 01:15:20 CEST 2011


Can't comment on the quality of Inline::C, but it seems like a nice
little stepping stone to getting started with using C with perl (or at
least in my case it lets me focus on figuring out the C and not worry
as much about the XS stuff right now).

Right now, this is just an experiment to see how big of a benefit
re-writing in C will give. Inline::C seemed like a quick way to get
started and prototype. If fruitful, full fledge XS will be in order.

Thanks for the input, setting the following Inline::C options I was
able to get it working:

use Inline C => Config => INC => "-I/pathcontaingingEVandheaders/",
BUILD_NOISY => 1,
MYEXTLIB => '/pathto/auto/EV/EV.so',
AUTO_INCLUDE => '#include "EV/EVAPI.h"',
BOOT => 'I_EV_API("Inline");';

Might be worth adding as a note in the documentation (for those new to
C and XS such as myself)?

Thanks again for all the help!

~Ryan

On Sat, Oct 1, 2011 at 3:13 PM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Sat, Oct 01, 2011 at 02:12:21PM -0700, Ryan Bullock <rrb3942 at gmail.com> wrote:
>> I am attempting to use EV/libev from Inline::C in an attempt to use
>> direct callbacks to C functions for a few performance critical
>> portions of a project I am working on.
>
> Bad idea - Inline::C is rather windowsish and ports badly to other
> platforms, and I am sure you will run into more problems.
>
>> Would anyone mind taking a look at it and telling me where I am going
>> wrong? Or is what I am attempting just not possible?
>
> You need to initialise the EV API (EV::MakeMaker has the code for that,
> specifically, see the BOOT: block, i.e. I_EV_API ("YourModule")) in your
> namespace.
>
> I don't know how to port BOOT blocks to Inline::C, but basically, you have
> to make sure you execute the boot code in every .c file where you use the
> EV api.
>
> --
>                The choice of a       Deliantra, the free code+content MORPG
>      -----==-     _GNU_              http://www.deliantra.net
>      ----==-- _       generation
>      ---==---(_)__  __ ____  __      Marc Lehmann
>      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
>      -=====/_/_//_/\_,_/ /_/\_\
>



More information about the libev mailing list