On Tue, Dec 15, 2009 at 12:05 AM, Nikolaus Rath <nikol...@rath.org> wrote:
> But what I don't understand his this: If exporting only one symbol "a"
> produces python code that cannot be imported (because it depends on the
> definition of another symbol 'b' that was not explicitly requested),
> what is the point of generating the code in the first place? Under which
> circumstances do you want to generate code that cannot be imported?

Consider use case, where your code is split between different modules:

module Base:
    struct B;

module Derived1:
    d( B* )

module Derived2:
    d2( B* )

In this case, when you exposed Derived* you don't want to expose struct B.

>> I understand that your use case is different than my - fine. I believe
>> Py++ has all functionality you need, to define what declarations
>> should be exported. Consider to use "reverse"logic:
>>
>> mb = ctypes_module_builder_t( ... )
>> mb.global_ns.exclude()
>> #and now define what you want to include
>>
>> May be you should take a look on
>> "module_builder/ctypes_decl_dependencies.py" module. It contains
>> "find_out_dependencies" functionality. As input it takes a set of
>> declarations you want to expose, the output is a set of all classes,
>> that need to be exposed.
>
> Actually I already did, but I failed to understand the interface once
> again. What exactly is a "set of declarations"? A list of the symbol
> names? A list of element as they are returned by e.g.
> global_ns.class_('mysymbol')?
>
> Can you tell me how to instruct Py++ to include the struct
> 'fuse_lowlevel_ops' and everything it that it depends on?

mb = ctypes_module_builder_t( ... )
mb.global_ns.exclude()

fuse_lowlevel_ops = mb.class_( ' 'fuse_lowlevel_ops' )

for d in find_out_dependencies( [fuse_lowlevel_ops] ):
    d.include()

I can't test the code right now, but it should look very similar to this.

HTH

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to