Tcl extensions built with lcc-win32



I'm currently trying to build a Tcl extension with the lcc-win32
compiler (platform windows xp, Tcl/Tk: ActiveState ActiveTcl 8.5.2.0).

This basically worked after transforming the Tcl libraries (tcl85.lib,
tk85.lib) to the lcc format (using the lcc GUI application "wedit" and
the menu option "Utils -> Import foreign library").

I could build and load my extension, but only when linking with the
non-stubs libraries (tcl85.[lib|dll], tk85.[lib|dll]). However, I was not
able to build a version of the extension using the Tcl stubs mechanism,
i.e. linking with the tclstub85.lib library (which I also transformed
to the lcc format). The dll of my extension is built without any
errors or warnings, but when I attempt to load the extension, Tcl
complains:

% load /path/to/extension.dll
couldn't load library "/path/to/extension.dll": this library or a dependent library could not be found in library path


I checked the dll with dumpbin.exe, the result is attached at the end
of this message. It seems that something is wrong with the functions
from the stubs library, however, I don't fully understand the
differences in linking and library inclusion for extensions without
and with the stubs mechanisms ...


It is BTW possible to build the extension with the Visual Express C++
compiler (both the non-stubs and the stubs version).


I found an old message indicating that the problem may be related
to the fact that the ActiveTcl libraries are built with the
Microsoft compiler:

Subject: Re: Winico using stubs library
Date: 2000/05/28
Newsgroups: comp.lang.tcl
Message-ID: <8gqi94$qhm$1@xxxxxxxxxxxxxxxxxxxx>


Do you think that there is a way to work around this problem, i.e.
to use the ActiveTcl stubs-libraries in combination with lcc-win32?


Thanks for any suggestions,
Olaf




Here the mentioned output of dumpbin.exe; the problems are probably
related to the first section: "Name of the dll unknown!"


C:\Path>dumpbin -imports extension.dll
Microsoft (R) COFF/PE Dumper Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file extension.dll

File Type: DLL

Section contains the following imports:

Name of the dll unknown!
100040CC Import Address Table
10004084 Import Name Table
0 time date stamp
0 Index of first forwarder reference

2 Tcl_InitStubs
6 tclStubsPtr

KERNEL32.dll
100040DC Import Address Table
10004094 Import Name Table
0 time date stamp
0 Index of first forwarder reference

9B ExitProcess
124 GetEnvironmentStringsA
278 RtlUnwind

CRTDLL.DLL
100040F0 Import Address Table
100040A8 Import Name Table
0 time date stamp
0 Index of first forwarder reference

80 _fdopen
14F _open_osfhandle
20D fclose
39 _cexit
24E malloc
260 raise
267 setbuf

Summary

1000 .data
1000 .edata
1000 .idata
1000 .rdata
1000 .reloc
1000 .text

.



Relevant Pages

  • Re: tcl 8.4 binary for windows
    ... activetcl release? ... Do you mean "a binary version of tcl 8.4 without other libraries"? ... Unless the widget in question is pure script, ...
    (comp.lang.tcl)
  • Re: Compatibility matrix?
    ... ActiveTcl to do their development of the Tcl code. ... proceeds on creating the starkit, ... binary libraries that will not be relevant to the platform. ...
    (comp.lang.tcl)
  • Re: Question about AS licence
    ... that extension included in my starkit? ... The extensions in ActiveTcl all have cooperative BSD licenses. ... Tcl Advocate's hat on, I think it's probably also a good idea to ... is why formal advertising requirements can be tricky) so ignore if it's ...
    (comp.lang.tcl)
  • Re: Question about loading a DLL
    ... Um, no, it doesn't really matter which C compiler you use, the process ... Your first problem is to understand how to to properly write an extension, ... TclStubs/or TclLibrary code, possibly some windows libraries, etc. ... where the Tcl makefiles (and more specifically the Tcl Extension ...
    (comp.lang.tcl)
  • Re: Question about loading a DLL
    ... Um, no, it doesn't really matter which C compiler you use, the process remains the same, but the details are different, that's all. ... I understand that Tcl/TK uses the VC++ compiler to compile/link the official windows downloads, and there are files in the tcl source tree which may be of some value to you. ... Your first problem is to understand how to to properly write an extension, and correctly pass arguments from the Tcl_Object interface to to your C/C++ library. ... TclStubs/or TclLibrary code, possibly some windows libraries, etc. ...
    (comp.lang.tcl)