If you want to call the AES functions inside a LDG-library, it is not possible to use the standard GEM C-library of your compiler because the AES functions binding use a local array variable containing some importants values for AES. But, it is possible to call the AES functions using the C-library MT_AES, provided with the LDG distribution. A MT_AES call is the same than the AES call excepted one parameter. This parameter is the AES array. Keep in mind that a LDG-function executed by a client is seen like a function of the client. So the client initiates a AES session, with appl_init() function and the LDG-function calls a MT_AES function, using the array parameter created by appl_init(). The first call of the ldg_exec() function initialized a global variable, ldg_global, that is an array of WORD and should be used to call the MT_AES functions. Thus, your LDG-function should receved as parameter this variable.
Here a small example :
In the client :
#include <gem.h> #include <ldg.h> int main( void) { LDG *a_lib; VOID CDECL (*a_function)( WORD*); appl_init(); a_lib = ldg_open( "A_LIB.LDG", ldg_global); a_function = ldg_find( "a_function", a_lib); (*a_function)( ldg_global); ... }
In the library :
#include <ldg.h> #include <mt_aes.h> VOID CDECL a_function( WORD *gl) { mt_form_alert( 1, "[1][A stupid function!][OK]", gl); }