<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 25 Jul 2016, at 17:58, Matt <<a href="mailto:mattator@gmail.com" class="">mattator@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">I am not sure there is any test for what you want to achieve. Maybe we<br class="">should<br class="">first write a minimal c++/c code example, demonstrating the problem.<br class="">There is a test called “unittests/plain_c_tester.py”, which is probably the<br class="">only C-things  pygccxml supports.<br class=""></blockquote>I don't see anything specific to C in this script ?!<br class=""></div></div></blockquote><div><br class=""></div><div>The plain_c.c file that is parsed contains C code. I did not read the test</div><div>in detail though, maybe it does not do what I think. I’ll need to investigate further.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">I would like to see how does pygccxml invoke castxml and then how<br class="">castxml invokes libclang etc... I've tried configuring the XML<br class="">generator with cflags="-nostdinc -I/usr/include" and would like to<br class="">make sure those flags are passed on.<br class=""></div></div></blockquote><div><br class=""></div><div>You will see the exact command line by setting:</div><span class="">utils.loggers.set_level(logging.DEBUG)<br class=""><br class=""></span><blockquote type="cite" class=""><div class=""><div class=""><br class="">Also I don't know if it's linked but I want my script to find where<br class="">the function "sigaction" is declared (I want the /usr/include/signal.h<br class="">declaration). I search with:<br class="">`criteria = declarations.calldef_matcher(name=row["name"])`<br class="">but right now pygccxml/castxml returns the structure in<br class="">/usr/include/x86_64-linux-gnu/bits/sigaction.h (which shouldn't be<br class="">resolved as calldef IMO). Is it correct ?<br class=""></div></div></blockquote><div><br class=""></div><div>I saw that you opened a separate issue for that one, we will continue that specific</div><div>discussion there: <a href="https://github.com/gccxml/pygccxml/issues/62" class="">https://github.com/gccxml/pygccxml/issues/62</a></div><div><br class=""></div><div>Could you please open an issue for your initial problem too ?</div><div>I will not be able to tackle all the problems at once,</div><div>so it is better to keep that documented in the bug tracker.</div><div><br class=""></div><div>Thanks</div><div><br class=""></div><div>Michka</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Thanks for your help :)<br class=""><br class=""><br class=""><blockquote type="cite" class="">Cheers<br class=""><br class="">Michka<br class=""><br class=""><br class=""><br class="">2016-07-22 16:21 GMT+02:00 Michka Popoff <<a href="mailto:michkapopoff@gmail.com" class="">michkapopoff@gmail.com</a>>:<br class=""><br class="">Hi<br class=""><br class="">thanks for the nice comments.<br class=""><br class="">Using print on declarations in pygccxml is a nice way to debug you code,<br class="">but often you may not want to rely on the __str__ implementation in you real<br class="">code.<br class=""><br class="">The output of the __str__ method may vary depending on you compiler /<br class="">platform / code,<br class="">and I can not guarantee that this will work in a reliable way in all the<br class="">situations.<br class="">This is something I may add to the documentation; __str__ is for debugging<br class="">purposes only.<br class=""><br class="">It is probably better to build the string you want by using the .name,<br class="">.return_type,<br class="">.arguments ... attributes. This is often more flexible, and also more<br class="">performant,<br class="">as you select only the things that you are interested in.<br class=""><br class="">Cheers<br class=""><br class="">Michka<br class=""><br class=""><br class="">On 22 Jul 2016, at 16:10, Matt <<a href="mailto:mattator@gmail.com" class="">mattator@gmail.com</a>> wrote:<br class=""><br class="">I found the code in declarations/free_calldef.py and hacked it<br class="">locally, I might copy/paste the code in my script later then.<br class=""><br class="">Sorry for the noise<br class=""><br class="">2016-07-22 15:36 GMT+02:00 Matt <<a href="mailto:mattator@gmail.com" class="">mattator@gmail.com</a>>:<br class=""><br class="">Hi,<br class=""><br class="">I've just started with pygccxml/castxml and I must admit it's quite<br class="">impressive: doc/examples and worked straightout of the box.<br class=""><br class="">I want to use pygccxml to generate wrapper functions around glibc<br class="">functions. I can't use LD_PRELOAD or --wrap techniques so I have to<br class="">copy/paste the declarations of these functions which is a pain.<br class="">I am trying to automate this copy/paste via pygccxml.<br class=""><br class="">So far, I have:<br class="">==<br class="">func1a = global_namespace.free_function(name="printf")<br class="">print(func1a)<br class="">==<br class="">which output:<br class="">extern int printf(__restrict__ char const * __format, ...) [free function]<br class="">is very near to what I want:<br class="">extern int printf(__restrict__ char const * __format, ...)<br class=""><br class="">I have done dir(func1a) to see which members I could use and grepped<br class="">for __str__ to see the magic but miserably fail to find the location.<br class="">How could I output the same declaration as in the header please ?<br class=""><br class=""><br class="">Cheers<br class=""><br class="">Nb: In the list of  programs using pygccxml you could add <a href="http://www.nsnam.org" class="">www.nsnam.org</a><br class=""><br class="">_______________________________________________<br class="">CastXML mailing list<br class=""><a href="mailto:CastXML@public.kitware.com" class="">CastXML@public.kitware.com</a><br class="">http://public.kitware.com/mailman/listinfo/castxml<br class=""><br class=""><br class=""><br class=""></blockquote></div></div></blockquote></div><br class=""></body></html>