# memory.h File Reference

`#include <gwenhywfar/gwenhywfarapi.h>`
`#include <gwenhywfar/types.h>`
`#include <gwenhywfar/error.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <assert.h>`

Go to the source code of this file.

## Defines

#define | GWEN_ATTACH(varname)
#define | GWEN_FREE(varname)
#define | GWEN_FREE_OBJECT(varname) free(varname)
#define | GWEN_LOCATION_FUNCTION ((__const char *) "unknown function")
#define | GWEN_NEW(typ, function)
#define | GWEN_NEW_OBJECT(typ, varname)

## Functions

GWENHYWFAR_API void | GWEN_Memory_AttachObject (void *object, const char *function, const char *file, int line)
GWENHYWFAR_API void | GWEN_Memory_FreeObject (void *object, const char *function, const char *file, int line)
GWENHYWFAR_API GWEN_ERRORCODE | GWEN_Memory_ModuleFini ()
GWENHYWFAR_API GWEN_ERRORCODE | GWEN_Memory_ModuleInit ()
GWENHYWFAR_API void * | GWEN_Memory_NewObject (void *p, const char *typeName, const char *function, const char *file, int line)
GWENHYWFAR_API void | GWEN_Memory_Report ()

## Define Documentation

#define GWEN_ATTACH | ( | varname |  | ) |

Value:

    GWEN_Memory_AttachObject((void*)varname,\
      GWEN_LOCATION_FUNCTION,\
      __FILE__,\
      __LINE__)

#define GWEN_FREE | ( | varname |  | ) |

Value:

    GWEN_Memory_FreeObject((void*)varname,\
      GWEN_LOCATION_FUNCTION,\
      __FILE__,\
      __LINE__)

#define GWEN_FREE_OBJECT | ( | varname |  | ) | free(varname)

#define GWEN_LOCATION_FUNCTION ((__const char *) "unknown function")

#define GWEN_NEW | ( | typ,
|  | function |  | ) |

Value:

    ((typ*)GWEN_Memory_NewObject(function,\
      __STRING(typ),\
      GWEN_LOCATION_FUNCTION, \
      __FILE__,\
      __LINE__))

#define GWEN_NEW_OBJECT | ( | typ,
|  | varname |  | ) |

Value:

    varname=(typ*)malloc(sizeof(typ));\
      assert(varname); \
      memset((void*)varname, 0, sizeof(typ));

## Function Documentation

GWENHYWFAR_API void GWEN_Memory_AttachObject | ( | void * | object,
|  | const char * | function,
|  | const char * | file,
|  | int | line
| ) |

GWENHYWFAR_API void GWEN_Memory_FreeObject | ( | void * | object,
|  | const char * | function,
|  | const char * | file,
|  | int | line
| ) |

GWENHYWFAR_API GWEN_ERRORCODE GWEN_Memory_ModuleFini | ( |  | ) |

GWENHYWFAR_API GWEN_ERRORCODE GWEN_Memory_ModuleInit | ( |  | ) |

GWENHYWFAR_API void* GWEN_Memory_NewObject | ( | void * | p,
|  | const char * | typeName,
|  | const char * | function,
|  | const char * | file,
|  | int | line
| ) |

GWENHYWFAR_API void GWEN_Memory_Report | ( |  | ) |