Load DLL in plugin?



  • On 19/05/2013 at 02:46, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R13+ 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Anybody know of the best way to load a dll from within a plugin (Command plugin in this case)?  There are no facilities in the SDK so it would either need to be platform specific or it might be made independent using Qt or some other library, one that supports dll loading/unloading, statically built into the plugin.



  • On 19/05/2013 at 05:34, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    <ADDRESS>
    User Information:
    Cinema 4D Version:   R13+ 
    Platform:   Windows  ;  
    Mac OSX  ; 
    Language(s) :    
    C++  ;

    ---------
    </ADDRESS> Anybody know of the best way to load a dll from within a plugin (Command plugin in this case)?  There are no facilities in the SDK so it would either need to be platform specific or it might be made independent using Qt or some other library, one that supports dll loading/unloading, statically built into the plugin.

    On the PC use:

      
    dll_handle = LoadLibrary( path );   
    

    (Have a look at MS docs for error codes).

    On OS X (/Linux) use

      
              handle = dlopen( path, mode );               // RTLD_LOCAL: The loaded images exported symbols are generally hidden. They are available only to dlsym invocations that use the handle returned by this function                  
              error_message = dlerror();   
              if ( error_message )   
                   GeDebugOut("OS error at dlopen %s", error_message );   
      
    

    (See man page or OS X docs for possible values of <mode> and error codes).

    Best regards,

    Wilfried



  • On 19/05/2013 at 08:08, xxxxxxxx wrote:

    Alright.  It looks like I will be going the platform-independent support way.

    Thanks!


Log in to reply