[PD] pd externals load/unload
Mathieu Bouchard
matju at artengine.ca
Mon Sep 11 20:01:43 CEST 2006
On Mon, 11 Sep 2006, Thomas Grill wrote:
> Hi Alberto,
>> Q1: suppose I'm working on an external: start pd, load it, control its
>> behaviour, destroy it, change the code, recompile it, replace it *in
>> the same session of PD*: is this supposed to crash pd?
>
> it won't crash pd, because once an object (with a certain name) is
> loaded, it won't be loaded again in the same session. The code stays
> active until you restart pd. The OS will decide if you can replace the
> binary file of the external object in use. I think Windows doesn't allow
> that.
It *can* crash pd. dlopen() uses mmap(), which transparently reads the
file from disk. What matters is whether the same inode is reused. If you
overwrite the file using gcc, it uses open() in O_TRUNC mode, so the same
inode is reused, and a crash may occur. If another program, say cp or
mv, removes the old filename before doing open(), or uses link() or
rename(), then the file is not overwritten, only the filename, so that pd
still uses the old file even though that file lost its name.
correct me if I'm wrong... but I'm sure I've seen pd crash when doing
"make". I believe it depends on whether you use "make install" or load the
external directly from where it was compiled.
_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada
More information about the Pd-list
mailing list