Changeset 5481:603d51e78e41 in roaraudio


Ignore:
Timestamp:
04/23/12 13:05:59 (9 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added support to load plugins on win32 (pr0).

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5479 r5481  
    1515        * Updated build options for RAT (pr0). 
    1616        * Work around bugs in win32 while using stdvios (pr0). 
     17        * Added support to load plugins on win32 (pr0). 
    1718 
    1819v. 1.0beta0 - Fri Mar 16 2012 19:39 CET 
  • libroar/roardl.c

    r5446 r5481  
    5959#if defined(ROAR_HAVE_LIBDL) 
    6060 void * handle; 
     61#elif defined(ROAR_TARGET_WIN32) 
     62 HMODULE handle; 
    6163#endif 
    6264}; 
     
    198200 
    199201 ROAR_DBG("_roardl2ldl(lhandle=%p) = %p", lhandle, (void*)(lhandle->handle)); 
     202 return lhandle->handle; 
     203} 
     204#elif defined(ROAR_TARGET_WIN32) 
     205static HMODULE _roardl2winhandle(struct roar_dl_lhandle * lhandle) { 
     206 if ( (void*)lhandle < (void*)128 ) { 
     207  return NULL; 
     208 } 
    200209 return lhandle->handle; 
    201210} 
     
    383392   return NULL; 
    384393  } 
     394#elif defined(ROAR_TARGET_WIN32) 
     395  ret->handle = LoadLibrary(filename); 
     396 
     397  if ( ret->handle == NULL ) { 
     398   roar_mm_free(ret); 
     399   return NULL; 
     400  } 
    385401#else 
    386402  roar_mm_free(ret); 
     
    399415   if ( ret->handle != NULL ) 
    400416    dlclose(ret->handle); 
     417#elif defined(ROAR_TARGET_WIN32) 
     418   if ( ret->handle != NULL ) 
     419    FreeLibrary(ret->handle); 
    401420#endif 
    402421   roar_mm_free(ret); 
     
    453472  ret = dlclose(_roardl2ldl(lhandle)); 
    454473 } 
     474#elif defined(ROAR_TARGET_WIN32) 
     475 if ( lhandle->handle == NULL ) { 
     476  ret = 0; 
     477 } else { 
     478  if ( FreeLibrary(_roardl2winhandle(lhandle)) ) { 
     479   ret = 0; 
     480  } else { 
     481   ret = -1; 
     482  } 
     483 } 
    455484#else 
    456485 ret = -1; 
     
    482511 
    483512 return ret; 
     513#elif defined(ROAR_TARGET_WIN32) 
     514 FARPROC ret = GetProcAddress(_roardl2winhandle(lhandle), sym); 
     515 return (void*)ret; 
    484516#else 
    485517 ROAR_DBG("roar_dl_getsym(lhandle=%p, sym='%s', type=%i) = NULL // errno=NOSYS", lhandle, sym, type, ret); 
     
    611643 (void)lhandle; 
    612644 return dlerror(); 
     645#elif defined(ROAR_TARGET_WIN32) 
     646 roar_err_from_errno(); 
     647 return roar_error2str(roar_error); 
    613648#else 
    614649 return NULL; 
Note: See TracChangeset for help on using the changeset viewer.