My guess is that part of your problem is the parameter lists not matching.
int (* length)();
and
int length(PString * self)
are not the same. It should be int (* length)(PString *);
.
...woah, it's Jon!
Edit: and, as mentioned below, your struct pointer is never set to point to anything. The way you're doing it would only work if you were declaring a plain struct, not a pointer.
str = (PString *)malloc(sizeof(PString));