andreas-kupries / critcl

Critcl lets you easily embed C code in Tcl. Online documentation at
http://andreas-kupries.github.io/critcl
Other
71 stars 19 forks source link

included headers cause problems with preload #52

Closed pdean closed 9 years ago

pdean commented 9 years ago

tclDecls.h and tclPlatDecls.h have const declarations incompatible with preload.c Suggest replace with versions from current distribution

andreas-kupries commented 9 years ago

Please tell me a bit more. Were you using the 8.4 headers, for example ? Or was it 8.5, 8.6 ? (This is controlled by the "critcl::tcl" command, and 8.4 is the default if none is specified)

pdean commented 9 years ago

On 19/03/15 05:07, Andreas Kupries wrote:

Please tell me a bit more. Were you using the 8.4 headers, for example ? Or was it 8.5, 8.6 ? (This is controlled by the "critcl::tcl" command, and 8.4 is the default if none is specified)

— Reply to this email directly or view it on GitHub https://github.com/andreas-kupries/critcl/issues/52#issuecomment-83124095.

Sorry I should have kept the details.

I've had the same problem with 8.4 and 8.5. This is on windows compiling with both mingw32 and mingw64. (8.4 accidently, I forgot critcl::tcl 8.5)

preload.c has these declarations TclStubs tclStubsPtr; TclPlatStubs tclPlatStubsPtr;

tclDecls.h included with critcl extern const TclStubs *tclStubsPtr;

tclDecls.h included with tcl 8.5 extern TclStubs *tclStubsPtr;

I think this is the problem. It certainly fixed it when I replaced the old headers

By the way, I'm actually a surveyor, not a computer programmer. It takes me longer than average to figure out what the problems are.

andreas-kupries commented 9 years ago

Pdean ... Do you need a test build of critcl from the above commit (branch issue-52) for testing ? Or are you able to get a checkout of the branch, and then reinstall critcl ? A question implicit in the above is, how do you have critcl installed in your environment ?

pdean commented 9 years ago

On 6/05/2015 6:30 AM, Andreas Kupries wrote:

Pdean ... Do you need a test build of critcl from the above commit (branch issue-52) for testing ? Or are you able to get a checkout of the branch, and then reinstall critcl ? A question implicit in the above is, how do you have critcl installed in your environment ?

That seems to fix it.

Activestate Tcl 8.5.17 (yes I know 8.5.18 is out). MSYS2 for gcc and git. I use this batch file to run critcl critcl.bat ...

::if no { @echo "Critcl batch file" @tclsh "%~f0" %* @goto :eof }

Tcl code start

package require critcl::app critcl::app::main $argv

Tcl code end \

:eof

I also use a special config for 64bit compile. I've never been sure whether this is right but seems to work

file config64 ...

mingw64 platform win32-x86_64 mingw64 compile gcc -c -nostdlib mingw64 link gcc -shared mingw64 link_preload mingw64 sharedlibext .dll mingw64 tcl_platform(byteOrder) littleEndian mingw64 tcl_platform(machine) amd64 mingw64 tcl_platform(os) Windows NT mingw64 tcl_platform(osVersion) 6.1 mingw64 tcl_platform(platform) windows mingw64 tcl_platform(wordSize) 4 mingw64 tcl_platform(pointerSize) 8

I only have 2 projects where I use preload. Here's the first few lines of one of them.

rxp.tcl

# package provide rxp 1 package require critcl critcl::tcl 8.5

critcl::ccode {

include

#include <stdio.h>
#include <math.h>
#include <string.h>

}

set riegl [file normalize U:\riegl\rivlib-2_0_0-x86_64-windows-mgw49] critcl::cheaders -I$riegl/include critcl::clibraries -L$riegl/lib critcl::clibraries $riegl/lib/scanifc-mt-s.dll critcl::preload $riegl/lib/scanifc-mt-s critcl::include riegl/scanifc.h

#

Running new branch issue-52 ...

$ cd ~/src/critcl $ git pull $ git checkout issue-52 $ which tclsh /c/Tcl/bin/tclsh

$ tclsh ./build.tcl install

Installing into: Packages: C:/Tcl/lib/tcl8.5 Application: C:/Tcl/bin

Installed package: C:/Tcl/lib/tcl8.5/critcl3.1.13 Installed package: C:/Tcl/lib/tcl8.5/critcl-util1 Installed package: C:/Tcl/lib/tcl8.5/critcl-class1.0.6 Installed package: C:/Tcl/lib/tcl8.5/critcl-iassoc1.0.2 Installed package: C:/Tcl/lib/tcl8.5/critcl-literals1.1 Installed package: C:/Tcl/lib/tcl8.5/critcl-enum1.0.1 Installed package: C:/Tcl/lib/tcl8.5/critcl-bitmap1.0.1 Installed package: C:/Tcl/lib/tcl8.5/critcl-emap1 Installed package: C:/Tcl/lib/tcl8.5/critcl-app3.1.13 Installed package: C:/Tcl/lib/tcl8.5/util84 Installed package: C:/Tcl/lib/tcl8.5/stubs Installed package: C:/Tcl/lib/tcl8.5/critcl-platform Installed application: C:/Tcl/bin/critcl

$ cd /u/tcl/src/scanning/fixrxp/fixrxp/fixrxp.vfs/ $ cmd /c makerxp.bat

U:\tcl\src\scanning\fixrxp\fixrxp\fixrxp.vfs>critcl -config config64 -target mingw64 -pkg rxp.tcl "Critcl batch file" Config: mingw64 Build: win32-x86_64-gcc Target: win32-x86_64 Source: rxp.tcl (provide rxp 1) (include <riegl/scanifc.h>) (importing rxp2ptg.tcl)

Warning rxp2ptg.tcl:286:5: warning: this decimal constant is unsigned only in ISO C90

Library: rxp.dll (tclStubsPtr => TclStubs tclStubsPtr;) (tclPlatStubsPtr => TclPlatStubs tclPlatStubsPtr;) Package: lib/rxp Preload: scanifc-mt-s

No errors! Thanks AK

pd

andreas-kupries commented 9 years ago

Thank you for testing. glad to see things working. Will merge ASAP.

andreas-kupries commented 9 years ago

commit 4863fe14cee5290d8f5bfda82333948f1689a052 Merge: 926f456 a3d618b Author: Andreas Kupries akupries@shaw.ca Date: Tue May 5 22:52:21 2015 -0700

Merge branch 'issue-52'