Is there a way to specify the name of a function when creating it with idc.MakeFunction()?

If not, what is the best practice to rename a function? I found idc.GetFunctionName(ea) but no counterpart to set a name. A google research turned up some examples where people used idc.MakeNameEx(). Yet, the purpose of MakeNameExseems to be to rename addresses:

def MakeNameEx(ea, name, flags): """ Rename an address

@param ea: linear address
@param name: new name of address. If name == "", then delete old name @param
flags: combination of SN_... constants

And involves a whole bunch of flags such as:

SN_NOCHECK    = idaapi.SN_NOCHECK    # Replace invalid chars with SubstChar
SN_PUBLIC     = idaapi.SN_PUBLIC     # if set, make name public 
SN_NON_PUBLIC = idaapi.SN_NON_PUBLIC # if set, make name non-public 
SN_WEAK       = idaapi.SN_WEAK       # if set, make name weak 
SN_NON_WEAK   = idaapi.SN_NON_WEAK   # if set, make name non-weak

What I need is a simple rename of a function keeping all its properties, flags etc...

1 Answer 1


idc.MakeName(ea, name) should suffice.

Note that the flags accepted by MakeNameEx() don't change the function's properties or function's flags; they're instead used with regard to how the naming itself is handled.

NB: ida_name.set_name is the new IDAPython API

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.