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

I've come to appreciate Win32::API for the fact that I can call any function in any reachable DLL without needing to bother with Inline, XS, a C compiler or anything like that. I'm wondering if an equivalent exists for Unix or if it would be possible to create one. Granted, on my Unix systems I, like most people, have a C compiler, but I feel like it would reduce debugging cycle time and make distribution easier if I could not depend on it. So my questions are:

  1. Does it already exist?
  2. If not, could it be written?
  3. If #2 is yes, approximately how might it work?
  4. If #2 is no, why not?

Cheers

Replies are listed 'Best First'.
Re: Win32::API equivalent for Unix
by chromatic (Archbishop) on Jan 17, 2006 at 06:18 UTC

    It's definitely doable. See thoughts about P5NCI, for example.

    When I get some free time, I plan to release a working version to the CPAN.

Re: Win32::API equivalent for Unix
by PodMaster (Abbot) on Jan 17, 2006 at 06:24 UTC
    C::DynaLib

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      See also the unfortunately abandoned FFI (and note that the latest C::DynaLib is nearly the same ancient age). I think there was also one more but I don't remember its name.

      It'd be nice to unify something here, I'd think...

      - tye        

Re: Win32::API equivalent for Unix
by schweini (Friar) on Jan 17, 2006 at 19:34 UTC
    i was also wondering something similar:
    since playing around with SOAP, i fell in love with the idea that function calls, which make up about 99% of programming, are relativly easily translated from programming language to programming language. would it therefore be possible to create a unified API that has different front- and backends for different programming languages, so that i can almost transparently call e.g. java methods from python, assembler routines from perl, etc.?
    now that i typed this, i realize that this is basically what SOAP is, but SOAP has a gigantic overhead for uses like this, and is too invasive...

      That would be terrific. I miss greatly the Active Perl Win32::NetAdmin module on UNIX. Probably would be possible to use SOAP to get around this, but is still a lot of trouble (and the punishment doesn't seem to fit the crime). Probably would be easier to use the Samba RPC lib and XS, but well... this a lot of trouble too!

      Regarding the SOAP overhead, maybe you would like to check YAML. I never tried it myself but received some reports that it works fine and is more simple than using XML.

      Alceu Rodrigues de Freitas Junior
      ---------------------------------
      "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill