2

I use ActiveStates TCL version 8.6.0.0 for Windows x64. In a script I call:

package require tcom

Tcom is included in the installation but I get the following error:

couldn't load libary "C:/TCL/lib/tcom/tcom.dll": Invalid argument while executing
"load C:/TCL/lib/tcom/tcom.dll"
("package ifneeded tcom 3.9" script)
invoked from within
"package require tcom"

Does anyone understand whats actually missing? C:/TCL/lib/tcom/tcom.dll is installed on my system, so what is the "invalid argument" ?

Lumpi
  • 2,697
  • 5
  • 38
  • 47
  • Are you sure about that error message? On my system, running a 32-bit version of ActiveTcl 8.6, tcom.dll is in `c:/tcl86/lib/teapot/package/win32-ix86/lib/tcom3.9/tcom.dll`, I'd expect a similar directory stucture on your system. What do you get if you do `puts stdout [package ifneeded tcom 3.9]`? On my system, that gives two tcl statements, seperated by a semicolon. I'd expect it to do the same on yours, what happens when you execute the two statements by hand? – nurdglaw May 30 '13 at 16:07
  • load C:/Tcl/lib/tcom/tcom.dll source C:/Tcl/lib/tcom/tcom.tcl When i execute load... i get: couldn't load library "C:/Tcl/lib/tcom/tcom.dll": invalid argument – Lumpi May 31 '13 at 07:35
  • Thanks, just checking. – nurdglaw May 31 '13 at 08:31

1 Answers1

3

This appears to be a 32-bit/64-bit issue. You can't mix different bit-sizes within the same process and you may well have installed a 64-bit build of ActiveTcl 8.6.0.0 under the belief that matching the size of the build and the system architecture is a good idea. Alas, this is not the case. ActiveTcl 8.6.0.0 for 64-bit Windows, for commercial reasons, requires an extra product key to access their 64-bit builds of external packages. But you've got the package installed anyway (perhaps from a previous installation of ActiveTcl?) and that appears to be a 32-bit build.

The misleading error from using the wrong size of binary library build is unfortunate (a relatively minor bug stemming from the subtle differences between Windows and POSIX and how Tcl handles the mapping between the two) but I'd bet that's it.

The easiest fix is to:

  1. Uninstall all copies of ActiveTcl that you've got installed, then
  2. Ensure that your C:\Tcl directory really is deleted, and then
  3. Install the 32-bit build of ActiveTcl 8.6.0.0 (which works just fine on Win64-based systems like 64-bit Windows 7 and Windows 8). Once you've done that, you
  4. Use teacup update to get a full set of packages installed and you should get Tcom working.

Except on ARM with extra trickiness, which doesn't apply here.
I'm not going to try to justify them; it's their decision, not mine.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • Many thanks for this answer, it took me many hours to reach this solution. For future google references, I'll just leave here that I got the error `couldn't load library "libmysqltcl.dll": invalid argument` because of this same problem (TCL was 64bit, the lib is 32). – msb Sep 18 '15 at 00:39