|
2013-09-06
| ||
| 23:09 | • Ticket [8419b6d9ae] Dynamic linking requres unicode on windows status still ... artifact: b5bd32378f user: jan.nijtmans | |
| 22:53 | • Closed ticket [8419b6d9ae]. artifact: 84ebaeac72 user: jan.nijtmans | |
| 22:49 | • Add attachment if_tcl.c.diff to ticket [8419b6d9ae] artifact: 8dbf6cf24a user: jan.nijtmans | |
|
2013-09-04
| ||
| 09:56 | • Ticket [8419b6d9ae] Dynamic linking requres unicode on windows status still ... artifact: bbdc4bd7cd user: anonymous | |
|
2013-09-03
| ||
| 22:07 | • Ticket [8419b6d9ae]: 3 changes artifact: f7ea773973 user: anonymous | |
| 21:53 | • Ticket [8419b6d9ae]: 3 changes artifact: 961dd4c2c3 user: anonymous | |
| 12:40 | • Ticket [8419b6d9ae]: 3 changes artifact: a469faf727 user: dgp | |
|
2013-09-02
| ||
| 13:35 | • Ticket [8419b6d9ae]: 3 changes artifact: c5377e696b user: jan.nijtmans | |
| 13:12 | • Pending ticket [8419b6d9ae]. artifact: f71b7e9513 user: jan.nijtmans | |
|
2013-09-01
| ||
| 22:07 | • Ticket [8419b6d9ae]: 3 changes artifact: 3fc082765b user: jan.nijtmans | |
|
2013-08-30
| ||
| 20:37 | • Ticket [8419b6d9ae]: 3 changes artifact: f099cd7ea6 user: anonymous | |
| 17:15 | • Ticket [8419b6d9ae]: 6 changes artifact: d4f3bca714 user: dgp | |
|
2013-08-29
| ||
| 16:34 | • New ticket [8419b6d9ae]. artifact: 13ff484bc9 user: anonymous | |
Dynamic linking requres unicode on windows
For windows, tclDecls.h undefines tcl_FindExecutable and redefines it only if UNICODE is defined. Therefore dynamic linking fails on non-UNICODE apps because of the undefined call. I was attempting to compile VIM7.4 with tcl dynamically linked, but it failed. I successfully compiled it by statically linking tcl. Windows 7, 64 bit, mingw64 compiler using source code from master branch of tcl repo.
Passing on to nijtmans, who I think is behind the changes. If the OP reads this, please clarify what release of Tcl (or checkin snapshot) you are trying to build.
Regarding request for which snapshot: Here is the info from fossil:
project-code: 1ec9da4c469c29f4717e2a967fe6b916d9c8c06e
checkout: 608930382ff3d2acdfdefa87a99ddb01ac63495b 2013-08-24 09:42:43 UTC
parent: af7ffdb548b4a5e6cf7049119c08571bf3c851fb 2013-08-23 16:23:47 UTC
merged-into: 219c73f7e8373b7c25c0af595b92e899fca1eb8e 2013-08-26 18:32:55 UTC
tags: trunk
comment: Unbreak doc; the apropos index entry *must* be one line. (This
is an external constraint forced by the requirement to fit into
the standard Unix manual system.) (user: dkf)
checkins: 16451
I'm not very familiar with fossil usage. So post again if more info is needed.
What's the error-message when linking? Is it a missing tclStubsPtr symbol? If so, then the problem is that you compiled your application with -DUSE_TCL_STUBS, but the tclStubPtr symbol was removed from the shared library. It works when statically linking, probably because you linked with the stub library which has this symbol.
This has no relation with -DUNICODE, for Unicode applications this wouldn't work either.
Solution: compile your application without -DUSE_TCL_STUBS.
>Passing on to nijtmans, who I think is behind the changes.
No I'm not in this case..... It's the removal of tclStubsPtr from the shared library which causes this change compared to 8.5
Let's take a minimal example:
#include <tcl.h>
void main(int argc, const char *argv[]){
Tcl_FindExecutable(argv[0]);
printf("OK\n");
}
Then (from a Cygwin or MSys shell):
$ i686-w64-mingw32-gcc -o main.exe main.c -I/Tcl/include -DUNICODE -D_UNICODE -L/Tcl/lib -ltcl86 $ ./main.exe OK $ i686-w64-mingw32-gcc -o main.exe main.c -I/Tcl/include -L/Tcl/lib -ltcl86 $ ./main.exe OK
Using -DUSE_TCL_STUBS has exactly the same result, for Tcl_FindExecutable that doesn't make any difference (for other functions it does)
Sorry, I cannot reproduce this problem.
Thank you nijtmans for the demonstrations. One detail I notice is that the ticket was opened complaining about building with mingw64 and your demos appear to be with mingw32 (or I just don't know how to decode the names). Any chance that could matter?
When compiling/linking, the only error I received was: objx86-64/if_tcl.o:if_tcl.c:(.text+0x2edd): undefined reference to `Tcl_FindExecutable' The relevant part of the compile was: -Id:/tools/tcl/include -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl 86.dll\" -DUSE_TCL_STUBS ... -Ld:/tools/tcl/lib -ltclstub86 In tclDecls.h, this function is undefined on WIN32 when UNICODE is not defined. In your example, you did not link to tclstub86, but to the tcl86, which I understood to be the static lib.
Just another note: I did some more research and checked here: http://tcl.activestate.com/doc/howto/stubs.html Perhaps a better description of this bug is "Dynamic Linking thru tclStubs requires UNICODE on windows" With the way tclDecls.h is defined, you cannot use stubs on Windows unless UNICODE is defined.
After compiling the example program given earlier by jan, I see that UNICODE is not the problem. I apologize. The problem is compiling against the tclstub lib. I have yet to build an example that complies and not crash. But that is probably on my end.
I see the problem. Attached to this ticket is a patch for if_tcl.c how this should be solved. The problem is that Tcl_FindExecutable() should be called BEFORE Tcl_CreateInterp(), which cannot be done through the stub table because it is not initialized yet. See the attached patch for the proper way how to do this. Tcl_FindExecutable() is in the stub table, but that was a design mistake. In Tcl 8.6 that cannot be done any more, that's on purpose. I hope this helps you further.
Reported to the VIM people as well:
Attachments:
- if_tcl.c.diff [download] added by jan.nijtmans on 2013-09-06 22:49:16. [details]