Module: Advantage::API

Defined in:
ext/advantage.c

Constant Summary collapse

VERSION =
rb_str_new2(VERSION)

Class Method Summary collapse

Class Method Details

.ads_finalize_interface(VALUEimp_drh) ⇒ nil

Finalize and free resources associated with the Advantage C API DLL.

This function will unload the library and uninitialize the supplied
AdvantageInterface structure.

<b>Parameters</b>:
- <tt>VALUE imp_drh</tt> -- An initialized API structure to finalize.

<b>Returns</b>:
- <tt>nil</tt>.

Returns:

  • (nil)


238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'ext/advantage.c', line 238

static VALUE
static_API_ads_finalize_interface(VALUE module, VALUE imp_drh)
{
    imp_drh_st* s_imp_drh;

    Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);

    ads_finalize_interface(&(s_imp_drh->api));

    free(&(s_imp_drh->api));

    return( Qnil );
}

.ads_initialize_interface(VALUEimp_drh) ⇒ Object

Initializes the AdvantageInterface object and loads the DLL dynamically.

This function attempts to load the Advantage C API DLL dynamically and
looks up all the entry points of the DLL.

<b>Parameters</b>:
- <tt>VALUE imp_drh</tt> -- An API structure to initialize.

<b>Returns</b>:
- <tt>result</tt>: <tt>1</tt> on successful initialization, <tt>0</tt> on failure.


209
210
211
212
213
214
215
216
217
218
219
220
# File 'ext/advantage.c', line 209

static VALUE
static_API_ads_initialize_interface(VALUE module, VALUE imp_drh)
{
    imp_drh_st* s_imp_drh;
    int result;

    Data_Get_Struct(imp_drh, imp_drh_st, s_imp_drh);

    result = ads_initialize_interface( &(s_imp_drh->api), NULL );

    return( INT2NUM(result) );
}