Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Interfacing Perl with C++, using XS, with external files, and using the STL as parameters and return values.

by dextius (Monk)
on Aug 05, 2010 at 17:37 UTC ( #853194=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    h2xs -A -n SimpleTest
    
  2. or download this
    mkdir SimpleTest/SimpleLib
    
  3. or download this
    #include <string>
    #include <map>
    ...
            protected:
                    int myInt;
    };
    
  4. or download this
    #include "Simple.H"
    #include <string>
    ...
            myVec.push_back("123");
            return myVec;
    }
    
  5. or download this
    use ExtUtils::MakeMaker;
    
    ...
            $(LD) $(O_FILES) -o unitTests
            ';
    }
    
  6. or download this
    #include "Simple.H"
    #include <iostream>
    ...
    
            return 0;
    }
    
  7. or download this
    perl Makefile.PL
    make
    make bin
    
  8. or download this
    ./unitTests
    
  9. or download this
    14
    |abc|
    
  10. or download this
    use 5.008003;
    use ExtUtils::MakeMaker;
    ...
            cd SimpleLib && $(MAKE) $(PASSTHRU)
    ';
    }
    
  11. or download this
    # Ahh now we are getting to the meat and potatoes of this monster.
    # Most of this mess is generated by h2xs, but let's see what else we g
    +ot.
    ...
                    StringVector myVec
            OUTPUT:
                    RETVAL
    
  12. or download this
    TYPEMAP
    Simple      * T_PTROBJ
    ...
            SvSetSV($arg, newRV_noinc((SV *)hv));
        }
    
  13. or download this
    #undef init_tm
    #undef do_open
    ...
    #ifdef ENTER
    #undef ENTER
    #endif
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://853194]
Approved by BrowserUk
Front-paged by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2021-03-08 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (123 votes). Check out past polls.

    Notices?