c call

Discussion in 'Perl Misc' started by George Mpouras, Mar 26, 2014.

  1. At windows I can call a C function as end user, using the Win32::API
    Can I do something similar at Linux ?
    Do not mention the inline because we assume that there is so access to C
    source.
     
    George Mpouras, Mar 26, 2014
    #1
    1. Advertisements

  2. AFAIK, no, as this would require generating different kinds of 'glue
    code' at run time, depending on whatever the calling conventions of the
    current platform happen to be.
     
    Rainer Weikusat, Mar 26, 2014
    #2
    1. Advertisements

  3. Never tried it myself, but try look at FFI::Library or FFI::Raw.

    //Makholm
     
    Peter Makholm, Mar 26, 2014
    #3
  4. George Mpouras

    $Bill Guest

    Easy enough to do, I would think, if you compile in a constant that tells
    you which calling convention the compiler is using.
     
    $Bill, Mar 27, 2014
    #4
  5. I don't know how the FFI module works internally (and can't easily
    determine that at the moment), but a naive approach would need explicitly written,
    platform-specific machine code.
     
    Rainer Weikusat, Mar 28, 2014
    #5
  6. George Mpouras

    ilovelinux Guest

    Op woensdag 26 maart 2014 13:35:43 UTC+1 schreef George Mpouras:
    How about the Inline module which makes it trivial to embed calls to other languages from Perl programs.
    http://search.cpan.org/dist/Inline/Inline.pod
     
    ilovelinux, May 5, 2014
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.