Package ghidra.program.model.data

# Interface FunctionDefinition

All Superinterfaces:
  `DataType`, `FunctionSignature`

All Known Implementing Classes:
  `FunctionDefinitionDataType`, `FunctionSignatureImpl`

public interface FunctionDefinition extends DataType, FunctionSignature
Defines a function signature for things like function pointers.

- ## Field Summary

  ### Fields inherited from interface ghidra.program.model.data.DataType

  `CONFLICT_SUFFIX, DEFAULT, NO_LAST_CHANGE_TIME, NO_SOURCE_SYNC_TIME, TYPEDEF_ATTRIBUTE_PREFIX, TYPEDEF_ATTRIBUTE_SUFFIX, VOID`

  ### Fields inherited from interface ghidra.program.model.listing.FunctionSignature

  `NORETURN_DISPLAY_STRING, VAR_ARGS_DISPLAY_STRING, VOID_PARAM_DISPLAY_STRING`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `replaceArgument(int ordinal, String name, DataType dt, String comment, SourceType source)`
  Replace the given argument with another data type
  `void`
  `setArguments(ParameterDefinition... args)`
  Set the arguments to this function.
  `void`
  `setCallingConvention(String conventionName)`
  Set the calling convention associated with this function definition.
  `void`
  `setComment(String comment)`
  Set the function comment
  `void`
  `setGenericCallingConvention(GenericCallingConvention genericCallingConvention)`
  Deprecated.
  Use of `GenericCallingConvention` is deprecated since arbitrary calling convention names are now supported.
  `void`
  `setNoReturn(boolean hasNoReturn)`
  Set whether or not this function has a return.
  `void`
  `setReturnType(DataType type)`
  Set the return data type for this function
  `void`
  `setVarArgs(boolean hasVarArgs)`
  Set whether parameters can be passed as a VarArg (variable argument list).

  ### Methods inherited from interface ghidra.program.model.data.DataType

  `addParent, clone, copy, dataTypeAlignmentChanged, dataTypeDeleted, dataTypeNameChanged, dataTypeReplaced, dataTypeSizeChanged, dependsOn, encodeRepresentation, encodeValue, getAlignedLength, getAlignment, getCategoryPath, getDataOrganization, getDataTypeManager, getDataTypePath, getDefaultAbbreviatedLabelPrefix, getDefaultLabelPrefix, getDefaultLabelPrefix, getDefaultOffcutLabelPrefix, getDefaultSettings, getDescription, getDisplayName, getLastChangeTime, getLastChangeTimeInSourceArchive, getLength, getMnemonic, getName, getParents, getPathName, getRepresentation, getSettingsDefinitions, getSourceArchive, getTypeDefSettingsDefinitions, getUniversalID, getValue, getValueClass, hasLanguageDependantLength, isDeleted, isEncodable, isEquivalent, isNotYetDefined, isZeroLength, removeParent, replaceWith, setCategoryPath, setDescription, setLastChangeTime, setLastChangeTimeInSourceArchive, setName, setNameAndCategory, setSourceArchive`

  ### Methods inherited from interface ghidra.program.model.listing.FunctionSignature

  `getArguments, getCallingConvention, getCallingConventionName, getComment, getName, getPrototypeString, getPrototypeString, getReturnType, hasNoReturn, hasUnknownCallingConventionName, hasVarArgs, isEquivalentSignature`

- ## Method Details

  - ### setArguments

    void setArguments(ParameterDefinition... args)
    Set the arguments to this function.
    Parameters:
      `args` - array of parameter definitions to be used as arguments to this function

  - ### setReturnType

    void setReturnType(DataType type) throws IllegalArgumentException
    Set the return data type for this function
    Parameters:
      `type` - the return datatype to be set.
    Throws:
      `IllegalArgumentException` - if data type is not a fixed length type

  - ### setComment

    void setComment(String comment)
    Set the function comment
    Parameters:
      `comment` - the comment to set.

  - ### setVarArgs

    void setVarArgs(boolean hasVarArgs)
    Set whether parameters can be passed as a VarArg (variable argument list).
    Parameters:
      `hasVarArgs` - true if this function has a variable argument list (ie printf(fmt, ...)).

  - ### setNoReturn

    void setNoReturn(boolean hasNoReturn)
    Set whether or not this function has a return.
    Parameters:
      `hasNoReturn` - true if this function does not return.

  - ### setGenericCallingConvention

    @Deprecated void setGenericCallingConvention(GenericCallingConvention genericCallingConvention)
    Deprecated.
    Use of `GenericCallingConvention` is deprecated since arbitrary calling convention names are now supported. `setCallingConvention(String)` should be used.
    Set the generic calling convention associated with this function definition.
    The total number of unique calling convention names used within a given `Program` or `DataTypeManager` may be limited (e.g., 127). When this limit is exceeded an error will be logged and this setting ignored.
    Parameters:
      `genericCallingConvention` - generic calling convention

  - ### setCallingConvention

    void setCallingConvention(String conventionName) throws InvalidInputException
    Set the calling convention associated with this function definition.
    The total number of unique calling convention names used within a given `Program` or `DataTypeManager` may be limited (e.g., 127). When this limit is exceeded an error will be logged and this setting ignored.
    Parameters:
      `conventionName` - calling convention name or null. This name is restricted to those defined by `GenericCallingConvention`, the associated compiler specification. The prototype model declaration name form (e.g., "__stdcall") should be specified as it appears in a compiler specification (*.cspec). The special "unknown" and "default" names are also allowed.
    Throws:
      `InvalidInputException` - if specified conventionName is not defined by `GenericCallingConvention` or the associated compiler specification if datatype manager has an associated program architecture.

  - ### replaceArgument

    void replaceArgument(int ordinal, String name, DataType dt, String comment, SourceType source)
    Replace the given argument with another data type
    Parameters:
      `ordinal` - the index of the argument to be replaced, starting from '0'
      `name` - name of the new argument
      `dt` - data type of the new argument
      `comment` - comment for the argument
      `source` - the source of this function definition argument: Symbol.DEFAULT, Symbol.ANALYSIS, Symbol.IMPORTED, or Symbol.USER_DEFINED