[PD-dev] How to pass indeterminate args to a thread

B. Bogart ben at ekran.org
Fri Feb 27 22:01:29 CET 2009


Thanks Claude!

I got lots of help from Matju on IRC so things are compiling.

I'm now getting a segfault when trying to access a member of the
structure in the thread function:

#0  0xf7d531cb in strlen () from /lib/i686/cmov/libc.so.6
#1  0xf7d1f648 in vfprintf () from /lib/i686/cmov/libc.so.6
#2  0xf7d43e04 in vsnprintf () from /lib/i686/cmov/libc.so.6
#3  0x080c68d6 in post (fmt=0xf7f7db5a "My symbol: %s")
    at s_print.c:51
#4  0xf7f7d829 in mythread ()
   from /home/bbogart/src/gphoto/src/pd-external/gphoto2.pd_linux

The way I'm trying to access the member is as follows:

post("My symbol: %s", ((struct floatArgStruct *)threadArgs)->s->s_name);

I've attached the full source.

All this typdef stuff is new to me, so I may have messed up something
obvious.

Thanks,
.b.


Claude Heiland-Allen wrote:

>>     post("My symbol: %s", threadArgs.s->s_name);    // line 92
> 
> threadArgs is a pointer, '.' is only for structs/unions
> 
> try '->' instead of '.' to both dereference pointer and access member
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gphoto2.c
Type: text/x-csrc
Size: 11675 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20090227/628190cc/attachment.c>


More information about the Pd-dev mailing list