[PD-dev] Using Shared libs in Externals
Ben Bogart - FMPM/F1999
bbogart at acs.ryerson.ca
Thu Jun 27 19:36:47 CEST 2002
Hello all,
I'm currently playing with the possibility of writing a SDL
(www.libsdl.org) PD external. I've ported my code to the PD external
format and can compile, but upon loading PD refuses to load the external
because it can't find the SDL library functions (Undefined Symbol).
So how can I access the SDL library functions from my external lib? How
can I link my lib to the sdl lib?
cc: -lSDL: linker input file unused since linking not done
cc: -lm: linker input file unused since linking not done
cc: -lpthread: linker input file unused since linking not done
Here is my current Makefile: (based on the 6.externs example)
current:
echo make pd_linux, pd_nt, pd_irix5, or pd_irix6
clean: ; rm -f *.pd_linux *.o
# ----------------------- LINUX i386 -----------------------
# Altered to compile SDL PD Externals
pd_linux: ben.pd_linux
.SUFFIXES: .pd_linux
CFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
-Wall -W -Wshadow -Wstrict-prototypes -Werror \
-Wno-unused -Wno-parentheses -Wno-switch
INCLUDE = -I../../src
LIBS = -lSDL -lm -lpthread
.c.pd_linux:
cc $(CFLAGS) $(LIBS) $(INCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
rm $*.o
I'm very new to C (been tinkering for only 2 weeks) so I'm still not
quite clear on the whole linking/compiling process.
Any pointers would be appriciated.
If seeing my (ugly) sourcecode would help I'd be happy to send it along.
Thanks
Ben
B. Bogart
---------
More information about the Pd-dev
mailing list