lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello ,

      In loadlib.c, line 128 :
      HINSTANCE lib = LoadLibrary(path);

      I think using LoadLibraryEx will be better. Like this:

      HINSTANCE lib = LoadLibraryEx(path,NULL,LOAD_WITH_ALTERED_SEARCH_PATH);

      The reason is the "Dynamic-Link Library Search Order" has
      changed after Windows XP SP2.
      (see http://msdn2.microsoft.com/en-us/library/ms682586.aspx )

      LoadLibrary will load dll in system directory before current
      directory by default settings.

      That is , if your module dll has a name the same with a dll in
      windows system directory, require may be failed.

      For example, I create a C module named console.dll and put it in
      my current directory. When I
      require "console" In lua, it failed.
      lua load the console.dll in windows\system32 instead of my
      .\console.dll .


-- 
Best regards,
 cloudwu                          mailto:cloudwu@163.com
            http://blog.codingnow.com

[恢弘志士之气, 不宜妄自菲薄]