[CastXML] how to print the exact same declaration as in the header ?
Michka Popoff
michkapopoff at gmail.com
Wed Jul 27 02:16:45 EDT 2016
> On 27 Jul 2016, at 00:53, Matt <mattator at gmail.com> wrote:
>
>>
>> You will see the exact command line by setting:
>> utils.loggers.set_level(logging.DEBUG)
> Yeah I found that afterwards :/
>
>
>> I saw that you opened a separate issue for that one, we will continue that
>> specific
>> discussion there: https://github.com/gccxml/pygccxml/issues/62
>>
>> Could you please open an issue for your initial problem too ?
> Which one was that, I had a few xD ? about the C code ? I think it's
> just a matter of calling gcc/clang instead of g++/clang++ as I found
> it on the command line. I also find it easier to track each problem on
> github.
Yes that one.
> I have found ways around all problems but the last, ie. the one that
> confounds structures and calls. The code is kinda hard to get into for
> this part.
Great. With minimal code examples replicating the problem
we should be able to fix that. But it may take time.
Michka
>
> Thanks for your help. Much appreciated already :)
>
> Matt
>
>> I will not be able to tackle all the problems at once,
>> so it is better to keep that documented in the bug tracker.
>>
>> Thanks
>>
>> Michka
>>
>>
>>
>> Thanks for your help :)
>>
>>
>> Cheers
>>
>> Michka
>>
>>
>>
>> 2016-07-22 16:21 GMT+02:00 Michka Popoff <michkapopoff at gmail.com>:
>>
>> Hi
>>
>> thanks for the nice comments.
>>
>> Using print on declarations in pygccxml is a nice way to debug you code,
>> but often you may not want to rely on the __str__ implementation in you real
>> code.
>>
>> The output of the __str__ method may vary depending on you compiler /
>> platform / code,
>> and I can not guarantee that this will work in a reliable way in all the
>> situations.
>> This is something I may add to the documentation; __str__ is for debugging
>> purposes only.
>>
>> It is probably better to build the string you want by using the .name,
>> .return_type,
>> .arguments ... attributes. This is often more flexible, and also more
>> performant,
>> as you select only the things that you are interested in.
>>
>> Cheers
>>
>> Michka
>>
>>
>> On 22 Jul 2016, at 16:10, Matt <mattator at gmail.com> wrote:
>>
>> I found the code in declarations/free_calldef.py and hacked it
>> locally, I might copy/paste the code in my script later then.
>>
>> Sorry for the noise
>>
>> 2016-07-22 15:36 GMT+02:00 Matt <mattator at gmail.com>:
>>
>> Hi,
>>
>> I've just started with pygccxml/castxml and I must admit it's quite
>> impressive: doc/examples and worked straightout of the box.
>>
>> I want to use pygccxml to generate wrapper functions around glibc
>> functions. I can't use LD_PRELOAD or --wrap techniques so I have to
>> copy/paste the declarations of these functions which is a pain.
>> I am trying to automate this copy/paste via pygccxml.
>>
>> So far, I have:
>> ==
>> func1a = global_namespace.free_function(name="printf")
>> print(func1a)
>> ==
>> which output:
>> extern int printf(__restrict__ char const * __format, ...) [free function]
>> is very near to what I want:
>> extern int printf(__restrict__ char const * __format, ...)
>>
>> I have done dir(func1a) to see which members I could use and grepped
>> for __str__ to see the magic but miserably fail to find the location.
>> How could I output the same declaration as in the header please ?
>>
>>
>> Cheers
>>
>> Nb: In the list of programs using pygccxml you could add www.nsnam.org
>>
>> _______________________________________________
>> CastXML mailing list
>> CastXML at public.kitware.com
>> http://public.kitware.com/mailman/listinfo/castxml
>>
>>
>>
>>
More information about the CastXML
mailing list