#1
  1. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    96

    mix c with perl?


    is there someway possible to mix perl into C source and compile it? also being able to use global variables in both sections would be necessary as well.
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,300
    Rep Power
    2223
    From the ActivePerl documentation:
    How do I embed the Perl interpreter into my C/C++ program?
    Writing applications that contain Perl interpreters using ActivePerl is identical to writing them for standard Perl. Consult the perlembed document for complete information and pointers to other sources of information.

    Note that the subject of embedding Perl interpreters inside applications is not a trivial one. You need to have experience writing C programs for Windows platforms before you should even think about writing an embedding Perl interpreters in your application.

    NOTE: ActivePerl 5xx series builds had a different mechanism for embedding that was restricted to C++. This is no longer supported. The standard way to embed interpreters now supports all the functionality that used to be available only with C++, and then some. Use the mechanisms described in the perlembed documentation.
    ActivePerl is a Windows port available for free at http://www.activestate.com/ . They also have Linux and Solaris versions as well as the same for python and tcl.

    Also, on the "C and Perl" resource page at at perl.com (http://www.perl.com/cs/user/query/q/6?id_topic=20 ) are links to the following articles:

    Calling Perl from C Programs
    An introduction to calling Perl subroutines directly from C, i.e., how to write callbacks. Examples of error handlers and event-driven programming are shown.

    How To Embed Perl In Your C program
    This document describes how to embed a perl interpreter and perl programs in a C program.

    Tutorial for XSUBs
    A tutorial on using XSUB to create extensions.

    XS Language Reference Manual
    A description of XS and XSUB, an extension interface for defining external subroutines.
  4. #3
  5. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    96
    nice thanks dwise

IMN logo majestic logo threadwatch logo seochat tools logo