Over the IDA Gui it is possible to export a structure with dependencies to a header file. For example if I export a struct that has one member from type DWORD than the header file also contains "typedef unsigned int DWORD".

I want to do a similar task with the python api.

def get_member_type(struct, idx):
   member = ida_struct.get_member(struct, idx)
   tif = tinfo_t()
   ida_struct.get_member_tinfo(member, tif)
   return tif

This function return the type of the struct members for example "DWORD" but how can I get the information that this is a unsigned int?

  • You can use the difference in size or offset value.
    – Biswapriyo
    Commented Feb 19, 2019 at 15:44
  • You're confusing things. You're asking about a local type but show example how you get a member of assembly structure, not a local type(there are 2 windows: Structures and Local Types).
    – KulaGGin
    Commented Feb 4, 2022 at 12:01

2 Answers 2


print_decls(ordinals_sring, flags) return a string with the same content as the "export to header file" option in the GUI.

The ordinals string can contain multiple ordinals seperated with a comma and all PDF_ Flags can be used (for example PDF_INCL_DEPS).


This works perfectly for me, it even delineates int from int32_t.

def get_member_typename(sid, offset):
    s = ida_struct.get_struc(sid)
    m = ida_struct.get_member(s, offset)
    tif = ida_typeinf.tinfo_t()
    if ida_struct.get_member_tinfo(m, tif):
        return tif.__str__() 
    return ""    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.