# Makefile
MODULE=helloworld
TYPEMAP=/usr/local/lib/perl5/5.8.7/ExtUtils/typemap
XSUBPP=/usr/local/lib/perl5/5.8.7/ExtUtils/xsubpp
PERLCORE=/usr/local/lib/perl5/5.8.7/i686-linux/CORE
CC=gcc
.PHONY: init clean
all : init libhelloworld.so
init :
perl -e "use Devel::PPPort; use ExtUtils::Constant qw (WriteConstants); \
Devel::PPPort::WriteFile(); WriteConstants(NAME => '$(MODULE)')"
libhelloworld.so : helloworld.o
$(CC) -shared helloworld.o -o $@
helloworld.c : helloworld.xs
perl $(XSUBPP) -typemap $(TYPEMAP) helloworld.xs >$@
helloworld.o : helloworld.c
$(CC) -Wall -fPIC -I$(PERLCORE) -I. -c helloworld.c -Wl,-rpath,. -o $@
clean :
rm -f helloworld.o helloworld.c const-c.inc const-xs.inc ppport.h
clean-all : clean
rm -f libhelloworld.so
####
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include
#include "const-c.inc"
#include "extlibs/myprint.h"
//#include "extlibs/myprint.c"
MODULE = helloworld PACKAGE = helloworld
INCLUDE: const-xs.inc
void
helloworld_proc()
CODE:
printf ("Helloworld\n");
boxing_print ("Helloworld");
####
package helloworld;
use 5.008007;
use strict;
use warnings;
use Carp;
require XSLoader;
our $VERSION = '0.01';
XSLoader::load('helloworld', $VERSION);
1;
####
# Makefile
localpath=/tmp/prova2/helloworld/extlibs
LD_RUN_PATH=$(localpath)
CC=gcc
.PHONY: clean clean-all
all : libmyprint.so test
myprint.o : myprint.c
$(CC) -c myprint.c -Fpic -o $@
libmyprint.so : myprint.o myprint.h
$(CC) -shared myprint.o -o $@
test : test.c
$(CC) -Wall test.c -I$(localpath) -L$(localpath) -Wl,-rpath,$(localpath) -lmyprint -o $@
clean :
rm -f *.o
clean-all : clean
rm -f *.so test
####
#include "stdio.h"
#include "string.h"
#include "myprint.h"
void boxing_print (char *st) {
int t=0;
for (t=0; t##
void boxing_print (char*);