dynamic libraries example

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

dynamic libraries example

Post by Antonio Linares »

gcc test.c -o test
./test

test.c

Code: Select all

#include <stdio.h>
#include <dlfcn.h>

void hb_vmInit( int );

int main( char * arg, int args )
{
    void * handle = dlopen ( "libharbour.2.1.0.dylib", RTLD_LAZY );
    void ( * hb_vmInit ) ( int );

    hb_vmInit = dlsym( handle, "hb_vmInit" );
    ( * hb_vmInit )( 1 );

    dlclose( handle );

    return 0;
}
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply