|
From: Rob M. <Rob...@ig...> - 2010-04-15 04:43:11
|
Hi William,
Yes, it does create all of that, but when I try to
use it in Python I get:
$ python
>>> from you_name_it import *
>>> a = you_name_it()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'you_name_it' is not defined
And because I can't actually define a variable
of type you_name_it, let alone a pointer to it,
or a pointer-to-pointer to it (still haven't
figured out how to get pointer-to-pointers...),
I can't call get_you_name_it().
Rob
William S Fulton wrote:
> Are you sure? When I use this simple interface file:
>
> %inline %{
> typedef void you_name_it;
> void get_you_name_it(you_name_it **yni) {}
> %}
>
> There are plenty of references in the generated code including:
>
> example_wrap.cxx:static swig_type_info _swigt__p_p_void = {"_p_p_void",
> "you_name_it **|void **", 0, 0, (void*)0, 0};
> example_wrap.cxx:static swig_type_info _swigt__p_void = {"_p_void",
> "you_name_it *|void *", 0, 0, (void*)0, 0};
>
> William
>
> Rob Marshall wrote:
>> I've found a way to work around it, but I was
>> just wondering if there was a way to get
>> "you_name_it" defined. The fact that there's
>> no reference to it at all means that I can't
>> create a pointer by the name of you_name_it.
>> I worked around it by using the "real" struct
>> name, but it would be nice if the voids didn't
>> just disappear.
>>
>> For example if I have a function call that says:
>>
>> get_you_name_it(you_name_it **yni)
>>
>> I have no way to create a pointer to a pointer
>> to you_name_it because it doesn't exist in the
>> wrapper and therefore isn't defined anywhere.
>> So I ended up writing a wrapper routine that
>> takes a pointer and calls the real function
>> with a pointer to that pointer.
>>
>> And while I'm on the subject, how do I create
>> a pointer to a pointer in Python?
>>
> wrap a method creating one:
>
> you_name_it** x();
>
>> I finally figured out that if I have a variable
>> defined I can get a pointer to it by doing:
>>
>> a = variable_name()
>>
>> But how do I get a pointer to a pointer? Or do
>> I always need to write a wrapper routine that
>> uses the simple pointer version (which is what
>> I've been doing)?
>>
>> Thanks,
>>
>> Rob
>>
>> William S Fulton wrote:
>>> Rob Marshall wrote:
>>>> Hi,
>>>>
>>>> In the library I'm trying to interface with (via
>>>> Python) there are several variables that are
>>>> defined as:
>>>>
>>>> typedef void you_name_it;
>>>>
>>>> When I look through the xxx_wrap.c file I don't see any
>>>> SWIGTYPE_p_you_name_it's anywhere. What do I need to do
>>>> in order to get these defined?
>>> SWIG uses the one type in the wrappers and as void and you_name_it
>>> are the same type, it chooses SWIGTYPE_void only - the reduced type.
>>> This should work for all wrappers, so I'm not sure why you want this.
>>>
>>> William
>>>
>>
>
|