sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Set path for request dlls

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 188 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      exvion
      last edited by

      I created mymodule.so. I put it in plugins/myplugin folder. Created myplugin.rb in plugins.
      myplugin.rb

      require 'myplugin/mymodule.so'
      

      If I run myplugin.rb, I get a message box that is not found mylib1.dll and mylib2.dll.
      How to specify where to find dlls?
      Copying mylib1.dll and mylib2.dll in sketchup folder solves this problem, but I would like to specify the location of the directory with dlls.

      1 Reply Last reply Reply Quote 0
      • E Offline
        exvion
        last edited by

        Solution

         
        require 'myplugin/Win32API'
        LoadLibrary = Win32API.new("kernel32","LoadLibrary",["P"],"I")
        path='' # set path to dir with dlls
        dllname=path+'mylib1.dll'
        LoadLibrary.call(dllname)
        dllname=path+'mylib2.dll'
        LoadLibrary.call(dllname)
        
        
        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Most people (who run Su on PC,) already have a copy of Win32API.so where their $LOAD_PATH array can find it, so you should only need to:
          require 'Win32API'
          if it's already loaded, require will skip reloading it.

          You can even get more fancy, by first checking if it's loaded, because it defines the class Win32API, and classnames are constants ie:

          unless (defined? Win32API)=='constant' %(#F0F0F0)[__]require 'Win32API' end

          Also.. I think you must unload those DLLs when your plugin is done with them. Perhaps you might need to use a custom AppObserver implementing the onQuit callback, with your plugin.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement