# EL_CalcEnoughBufferSizeforLink*

## Syntax

  `#include <twl/el.h>`
  `s32 EL_CalcEnoughBufferSizeforLink( ELReadImage readfunc, u32 len, const void* buf, ELLinkMode link_mode );`
  `s32 EL_CalcEnoughBufferSizeforLinkFile( const char* FilePath, const void* buf, ELLinkMode link_mode);`
  `s32 EL_CalcEnoughBufferSizeforLinkImage( void* obj_image, u32 obj_len, const void* buf, ELLinkMode link_mode );`

## Arguments

readfunc | Developer-specific Read function.
FilePath | Path name of the dynamic module to register.
obj_image | Memory address of the dynamic module to register.
len / obj_len | Size of the dynamic module to register.
buf | Buffer where the dynamic module will be registered. Nothing is actually written here.
link_mode | Mode when the dynamic link is tested. As of now, the only mode that can be specified is `EL_LINKMODE_ONESHOT`.

## Return Values

If the process succeeds, the function returns the required buffer size.
If it fails, it returns a value of -1.

## Description

Determines what size buffer is enough to register the dynamic module to the EL library.
If the dynamic module makes external references, this function may return a somewhat larger size.
The `EL_CalcEnoughBufferSizeforLink` function uses the user-specified read function to read the dynamic module.
The `EL_CalcEnoughBufferSizeforLinkFile` function reads the dynamic module being registered from ROM.
The `EL_CalcEnoughBufferSizeforLinkImage` function uses the dynamic module that has been loaded into memory.

## See Also

`ELReadImage`

## Revision History

2009/01/14 Initial version.

CONFIDENTIAL