[PD] re-Tcl_LinkVar

IOhannes m zmoelnig zmoelnig at iem.at
Thu Aug 25 16:21:13 CEST 2005


nico wrote:
> hi
> 
> 
> what does mean link against tcl-librairies.
> my staring point was you "howto write an external", and you don't write 
> anything about that ((((

well, the document is about "how to write an external" and not "how to 
write C-programs" (there are better books out there that cover this)

> 
> in the first line i've put:
> #include <tcl.h>
> #include "m_pd.h"
> but it doesn't seem to be enough

no it is not.

the header-files just tell the computer that there are other functions 
in the world out there which the compiler didn't knew before. they keep 
it from thinking that you are just inventing names.
however, when you use these functions, the unit that executes your code 
(when running the external) needs to know what they actually do.
thus you have to tell the computer, where it should look for a function 
like Tcl_LinkVar() (if it would go and search your entire harddisk for a 
function like Tcl_LinkVar() this would take ages): you normally do this 
in the link-process, where you tell the linker that it should consider 
certain files ("libraries") to look for functions it does not know.

therefore you have to link your external to the tcl-library.
how you tell your linker to do this, depends on your linker, so you 
should read the documentation for your linker. wth gcc, you add 
libraries with the "-l" flag, so "ld -ltcl8.4 tclexternal.o 
tclexternal.pd_darwin" will link your "tclexternal.o" with 
"libtcl8.4.so" (or the like) to produce "tclexternal.pd_darwin"



mfg.a.sdr
IOhannes





More information about the Pd-list mailing list