[C++-sig] [Py++] Missing struct

Nikolaus Rath Nikolaus at rath.org
Mon Dec 14 20:38:12 CET 2009


Nikolaus Rath <Nikolaus at rath.org> writes:
> Roman Yakovenko <roman.yakovenko at gmail.com> writes:
>> On Mon, Dec 14, 2009 at 3:14 PM, Nikolaus Rath <Nikolaus at rath.org> wrote:
>>> Roman Yakovenko <roman.yakovenko at gmail.com> writes:
>>>>> Why is the fuse_file_info struct not translated into ctypes code?
>>>>
>>>> This is because Py++ tries to make some intelligent guess what to
>>>> export. By default it exports all declarations found in the files in
>>>> the same directory.
>>>
>>> Hmm. Is there any actual use case for that? Just exporting the
>>> declarations in one file without taking into account their dependencies
>>> doesn't make much sense to me.
>>
>> //pseudo code
>> #include "stdio.h"
>>
>> void do_smth( int i ){
>>     printf( i );
>> }
>>
>> Do you still think Py++ needs to export every declaration that comes
>> from "stdio.h" header?
>
> No, but that's not what I'm saying. The only dependency here is printf,
> so Py++ should export do_smth, because it is from the main file, and
> printf from stdio.h, because do_smth depends on it.

I have to correct myself. printf() is actually only important for the
implementation, so as far as ctypes is concerned, the above code does
not have any dependencies at all and I would not expect Py++ to export
any stdio.h symbols.

In the following case however, I would expect Py++ to export struct stat
from stat.h, since the code depends on it and I don't really see why
anyone would want to export only do_smth (since the generated code won't
even load into Python due to a missing symbol):

#include <sys/stat.h>

void do_smth(struct stat* foo) {
   printf(foo->st_ino);
}


I hope that clarifies what I mean.

Best,


   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C



More information about the Cplusplus-sig mailing list