[nycbug-talk] invalid type argument of '->'

Tim A. techneck at goldenpath.org
Fri Mar 21 13:07:07 EDT 2008


Tim A. wrote:
> Michael Hernandez wrote:
>> On Mar 18, 2008, at 3:36 PM, Marc Spitzer wrote:
>>
>>   
>>> On Tue, Mar 18, 2008 at 2:46 PM, Michael Hernandez
>>> <mhernandez at techally.com> wrote:
>>>     
>>>> I am trying to build the php5-spl port and I keep getting errors like
>>>> this:
>>>>
>>>> /usr/ports/devel/php5-spl/work/php-5.2.5/ext/spl/php_spl.c:61: error:
>>>> invalid type argument of `->'
>>>>
>>>> I looked at php_spl.c - I don't see what's wrong with it. The line  
>>>> is:
>>>>
>>>> spl_globals->autoload_extensions     = NULL;
>>>>
>>>>
>>>> Is that not valid code? Is my gcc just old? I'm running out of ideas
>>>> here. Any help would be appreciated.
>>>>       
>>> is spl_globals a pointer?  Stupid question but it is complaining that
>>> it can not do a pointer dereference and access structure field.
>>>
>>> marc
>>>
>>>     
>>
>> To be quite honest, I'm not sure - I guess the PHP hackers might be  
>> too used to hacking in PHP and so their C is getting sloppy? Which  
>> isn't good since PHP is written in C, not PHP. :)
>>
>>   
>
> I just gave it a go. Installed from port just fine on 6.2.
> Stupid question, but have you tried a portsnap?
>

I've been brushing up on my C lately. (btw, O'Reilly's C Pocket 
Reference is really good.)
So, Mark's pointer question got me curious and I thought I'd look it up.
It seems easy enough to determine.
Assuming we're in /usr/ports/devel/php5-spl
After you've at least attempted to install the port once, you should 
have a directory called work.
# find work -type f -exec grep -Hn spl_globals {} \;

Which indicates as I might have suspected, the answer is in php_spl.h

I think the following lines indicate that spl_globals is a pointer 
variable of type zend_spl_globals which would appear to be a pointer to 
a structure but I can't find where zend_spl_globals is implemented. It 
seems to not be in these source files.

#ifdef ZTS
# define SPL_G(v) TSRMG(spl_globals_id, zend_spl_globals *, v)
extern int spl_globals_id;
#else
# define SPL_G(v) (spl_globals.v)
extern zend_spl_globals spl_globals;
#endif


I don't understand preprocessing though. So, I'm not sure exactly what 
the # define lines mean or how they work. (Coming up to that part).
Only thing I ever used those for were including standard headers.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20080321/769f3ac1/attachment.html>


More information about the talk mailing list