From: George Petasis on
Hi all,

I have compiled a group of DLLs and a SWIG-generated wrapper
DLL for exposing some C functions as Tcl commands.

However, loading the wrapper DLL under Tcl fails. All DLLs
are in the same directory (along with all dependent DLLs).

Under tkcon, I get:
cd {C:\Users\petasis\redland\Windows}
load ./redland.dll Redland
couldn't load library "./redland.dll": could not find specified procedure

I have tried loading the dll in dependency walker, and all seem
ok. However, profiling wish.exe in dependency walker when loading
the dll shows the following:

LoadLibraryW("C:/Users/petasis/redland/Windows/redland.dll") called from
"TCL84.DLL" at address 0x10069881.
Loaded "REDLAND.DLL" at address 0x01A80000. Successfully hooked module.
Loaded "RAPTOR.DLL" at address 0x01AB0000. Successfully hooked module.
Loaded "LIBXML2.DLL" at address 0x01B00000. Successfully hooked module.
Loaded "ICONV.DLL" at address 0x01BA0000. Successfully hooked module.
Unloaded "REDLAND.DLL" at address 0x01A80000.
Unloaded "RAPTOR.DLL" at address 0x01AB0000.
Unloaded "LIBXML2.DLL" at address 0x01B00000.
Unloaded "ICONV.DLL" at address 0x01BA0000.
LoadLibraryW("C:/Users/petasis/redland/Windows/redland.dll") returned
NULL. Error: The specified procedure could not be found (127).
LoadLibraryW("./redland.dll") called from "TCL84.DLL" at address 0x100698A7.
Loaded "REDLAND.DLL" at address 0x01A80000. Successfully hooked module.
Loaded "RAPTOR.DLL" at address 0x01AB0000. Successfully hooked module.
Loaded "LIBXML2.DLL" at address 0x01B00000. Successfully hooked module.
Loaded "ICONV.DLL" at address 0x01BA0000. Successfully hooked module.
Unloaded "REDLAND.DLL" at address 0x01A80000.
Unloaded "RAPTOR.DLL" at address 0x01AB0000.
Unloaded "LIBXML2.DLL" at address 0x01B00000.
Unloaded "ICONV.DLL" at address 0x01BA0000.
LoadLibraryW("./redland.dll") returned NULL. Error: The specified
procedure could not be found (127).

How can I find more info on which dll LoadLibrary fails, and which is
this failing procedure? (The ICONV.DLL is the one shipped with
ActiveTcl, loaded from Tcl/bin, so it should be ok). Is the problem
in the next to be loaded dll?

George
From: George Petasis on
After a little more testing, I have found the following:

The library I want to load
(c:\users\petasis\redland\windows\REDLAND.DLL) depends on:

c:\users\petasis\redland\windows\RAPTOR.DLL
c:\users\petasis\redland\windows\LIBRDF.DLL
c:\windows\system32\MSVCR71.DLL
c:\windows\system32\KERNEL32.DLL

The first dll (raptor.dll) depends on:

c:\users\petasis\redland\windows\LIBXML2.DLL
c:\users\petasis\redland\windows\LIBXSLT.DLL
c:\users\petasis\redland\windows\LIBCURL.DLL
c:\windows\system32\MSVCR71.DLL

HOWEVER, when loading directly redland.dll, then
the system automatically loads two other dlls
(libxml2.dll & libxslt.dll) that are located in the
bin directory of ActiveTcl. If they get loaded, then
reptor.dll & thus redland.dll cannot be loaded.

If I use the dll extension (yet another dll caller)
to load directly *my* dlls, everything seems ok:

(Windows) 51 % load dll.dll
dll 1.0, namespace: ::dll
(Windows) 52 % ::dll::load [file native
c:/Users/petasis/redland/Windows/libxml2.dll]
27918336
(Windows) 53 % ::dll::load [file native
c:/Users/petasis/redland/Windows/libxslt.dll]
30212096
(Windows) 54 % load redland.dll
(Windows) 55 %

So, now my problem is: how to avoid loading the ActiveTcl
dlls and load my own? And what if the user has previously loaded
tclxml and the dlls have already been loaded?

George
From: Robert Heller on
At Thu, 24 Aug 2006 03:52:46 +0300 George Petasis <petasis(a)iit.demokritos.gr> wrote:

>
> After a little more testing, I have found the following:
>
> The library I want to load
> (c:\users\petasis\redland\windows\REDLAND.DLL) depends on:
>
> c:\users\petasis\redland\windows\RAPTOR.DLL
> c:\users\petasis\redland\windows\LIBRDF.DLL
> c:\windows\system32\MSVCR71.DLL
> c:\windows\system32\KERNEL32.DLL
>
> The first dll (raptor.dll) depends on:
>
> c:\users\petasis\redland\windows\LIBXML2.DLL
> c:\users\petasis\redland\windows\LIBXSLT.DLL
> c:\users\petasis\redland\windows\LIBCURL.DLL
> c:\windows\system32\MSVCR71.DLL
>
> HOWEVER, when loading directly redland.dll, then
> the system automatically loads two other dlls
> (libxml2.dll & libxslt.dll) that are located in the
> bin directory of ActiveTcl. If they get loaded, then
> reptor.dll & thus redland.dll cannot be loaded.
>
> If I use the dll extension (yet another dll caller)
> to load directly *my* dlls, everything seems ok:
>
> (Windows) 51 % load dll.dll
> dll 1.0, namespace: ::dll
> (Windows) 52 % ::dll::load [file native
> c:/Users/petasis/redland/Windows/libxml2.dll]
> 27918336
> (Windows) 53 % ::dll::load [file native
> c:/Users/petasis/redland/Windows/libxslt.dll]
> 30212096
> (Windows) 54 % load redland.dll
> (Windows) 55 %
>
> So, now my problem is: how to avoid loading the ActiveTcl
> dlls and load my own? And what if the user has previously loaded
> tclxml and the dlls have already been loaded?

I take it that your c:/Users/petasis/redland/Windows/libxml2.dll and
c:/Users/petasis/redland/Windows/libxslt.dll are different than the same
named dlls in the ActiveState bin directory. Maybe you should name
them differently?

>
> George
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller(a)deepsoft.com -- Contract Programming: C/C++, Tcl/Tk

From: Ralf Fassel on
* George Petasis <petasis(a)iit.demokritos.gr>
| So, now my problem is: how to avoid loading the ActiveTcl dlls and
| load my own? And what if the user has previously loaded tclxml and
| the dlls have already been loaded?

http://en.wikipedia.org/wiki/DLL_hell has some pointers to M$-pages
which give some possible solutions. Probbaly one of those works for
you...

HTH
R'