| IDA SDK

Public Attributes | Public Member Functions | List of all members
extlang_t Struct Reference

## Detailed Description

External language (to support third party language interpreters)

## Public Attributes
size_t | size
| Size of this structure.
uint32 | flags
| Language features.
int32 | refcnt
| Reference count.
const char * | name
| Language name.
const char * | fileext
| File name extension for the language.
syntax_highlighter_t * | highlighter
bool(idaapi * | compile_expr )(const char *name, ea_t current_ea, const char *expr, qstring *errbuf)
| Compile an expression. More...
bool(idaapi * | compile_file )(const char *file, const char *requested_namespace, qstring *errbuf)
| Compile (load) a file. More...
bool(idaapi * | call_func )(idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)
| Evaluate a previously compiled expression. More...
bool(idaapi * | eval_expr )(idc_value_t *rv, ea_t current_ea, const char *expr, qstring *errbuf)
| Compile and evaluate an expression. More...
bool(idaapi * | eval_snippet )(const char *str, qstring *errbuf)
| Compile and execute a string with statements. More...
bool(idaapi * | create_object )(idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)
| Create an object instance. More...
bool(idaapi * | get_attr )(idc_value_t *result, const idc_value_t *obj, const char *attr)
| Returns the attribute value of a given object from the global scope. More...
bool(idaapi * | set_attr )(idc_value_t *obj, const char *attr, const idc_value_t &value)
| Sets the attribute value of a given object in the global scope. More...
bool(idaapi * | call_method )(idc_value_t *result, const idc_value_t *obj, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)
| Calls a member function. More...
bool(idaapi * | load_procmod )(idc_value_t *procobj, const char *path, qstring *errbuf)
| Compile (load) a file with processor module. More...
bool(idaapi * | unload_procmod )(const char *path, qstring *errbuf)
| Unload previously loaded processor module. More...

## Public Member Functions
bool | is_idc (void) const
bool | is_namespace_aware (void) const
void | release (void)

## Member Data Documentation

## ◆ compile_expr

bool(idaapi * extlang_t::compile_expr) (const char *name, ea_t current_ea, const char *expr, qstring *errbuf)

Compile an expression.

Parameters

  | name | name of the function which will hold the compiled expression
  | current_ea | current address. if unknown then BADADDR
  | expr | expression to compile
  [out] | errbuf | error message if compilation fails

Returns
  success

## ◆ compile_file

bool(idaapi * extlang_t::compile_file) (const char *file, const char *requested_namespace, qstring *errbuf)

Compile (load) a file.

If an extlang_t object claims to be namespace-aware, it means its 'compile_file()' will receive a requested namespace to compile a file under.

For example, compile_file() might receive a file '.../loaders/myloader.py', with the corresponding namespace: '__loaders__myloader'

Accordingly, call_func() has to be prepared to receive a function name that is namespace-qualified: "__loaders__myloader.accept_file()".

Parameters

  | file | file name
  | requested_namespace | requested namespace, may be ignored if not namespace-aware
  [out] | errbuf | error message if compilation fails

## ◆ call_func

bool(idaapi * extlang_t::call_func) (idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)

Evaluate a previously compiled expression.

Parameters

  [out] | result | function result or exception
  | name | function to call
  | nargs | number of input arguments
  | args | input arguments
  [out] | errbuf | error message if evaluation fails

Returns
  success

## ◆ eval_expr

bool(idaapi * extlang_t::eval_expr) (idc_value_t *rv, ea_t current_ea, const char *expr, qstring *errbuf)

Compile and evaluate an expression.

Parameters

  [out] | rv | expression value or exception
  | current_ea | current address. if unknown then BADADDR
  | expr | expression to evaluate
  [out] | errbuf | error message if evaluation fails

Returns
  success

## ◆ eval_snippet

bool(idaapi * extlang_t::eval_snippet) (const char *str, qstring *errbuf)

Compile and execute a string with statements.

(see also: eval_expr() which works with expressions)

Parameters

  | str | input string to execute
  [out] | errbuf | error message

Returns
  success

## ◆ create_object

bool(idaapi * extlang_t::create_object) (idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)

Create an object instance.

Parameters

  result | created object or exception
  name | object class name
  args | input arguments
  nargs | number of input arguments
  errbuf | error message if evaluation fails

Returns
  success

## ◆ get_attr

bool(idaapi * extlang_t::get_attr) (idc_value_t *result, const idc_value_t *obj, const char *attr)

Returns the attribute value of a given object from the global scope.

Parameters

  [out] | result | attribute value
  | obj | object (may be nullptr)
  | attr | attribute name. if nullptr or empty string then the object instance name (i.e. class name) should be returned.

Returns
  success

## ◆ set_attr

bool(idaapi * extlang_t::set_attr) (idc_value_t *obj, const char *attr, const idc_value_t &value)

Sets the attribute value of a given object in the global scope.

Parameters

  obj | object (may be nullptr)
  attr | attribute name
  value | attribute value

Returns
  success

## ◆ call_method

bool(idaapi * extlang_t::call_method) (idc_value_t *result, const idc_value_t *obj, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)

Calls a member function.

Parameters

  [out] | result | function result or exception
  | obj | object instance
  | name | method name to call
  | args | input arguments
  | nargs | number of input arguments
  [out] | errbuf | error message if evaluation fails

Returns
  success

## ◆ load_procmod

bool(idaapi * extlang_t::load_procmod) (idc_value_t *procobj, const char *path, qstring *errbuf)

Compile (load) a file with processor module.

See the note about namespace-awareness in compile_file()

Parameters

  [out] | procobj | created object or exception
  | path | processor module file name
  [out] | errbuf | error message if compilation fails

Return values

  true | success
  false | if errbuf is empty then file has been loaded (compiled) successfully but it doesn't contain processor module

## ◆ unload_procmod

bool(idaapi * extlang_t::unload_procmod) (const char *path, qstring *errbuf)

Unload previously loaded processor module.

Parameters

  | path | processor module file name
  [out] | errbuff | error message if compilation fails

Returns
  success

The documentation for this struct was generated from the following file:

- expr.hpp