My question should have been asked many times, but even I tried
already many proposed solution, I didn't find the right solution.
Many years ago, I written some nice tcl/tk applications, that I
compiled thanks to cygwin and mktclapp.
I found it cool to combine C and tcl.
Now I wanted to do the same with the last tcl release
I got the last tcl/tk version tcl8.6, have to compile it with MinGw
(Doesn't work with cygwin anymore), and after that, tried to use again
mktclapp
I tried with the hello.c example given on http://www.hwaci.com/sw/mktclapp/mktclapp.html
the compilation of hello.h and hello.c doesn't work .
Please, could anybody help me to show me how to compile the hello.c
thanks to MinGW
Or in other words, to convert tcl in a standalone application thanks
to MinGw
Many thanks
Christian
If wish (or tclsh) is combined with c using the load command, you may
use a starpack.
Then, you only have to compile your c extension and any C compiler may
be used for this task.
Afterwars, you may bind the .tcl and .c files to a precompiled wish/
tclsh exe of any version.
Hope this helps,
Harald
Thank you Harald.
But I didn't understand what you mean with "load command".
Years ago it was so simple to combine C and tcl thanks to mktclapp.
Recently for a pure tcl application a tried freewrap, but the code was
not portable to another PC, the were problems with paths, that I never
could resolve (Document is not clear)
What is crazy, is that it is so complicate to convert a simple tcl
code, in a executable
All the way, many thanks, and if you could have some tricks, I would
appreciate
Christian
>
> On 3 ao=FBt, 17:20, Harald Oehlmann <wortka...@yahoo.de> wrote:
> > On 3 Aug., 16:24, CKL <christian.klugesh...@gmail.com> wrote:
> >
> > > My question should have been asked many times, but even I tried
> > > already many proposed solution, I didn't find the right solution.
> > > Many years ago, I written some nice tcl/tk applications, that I
> > > compiled thanks to cygwin and mktclapp.
> > > I found it cool to combine C and tcl.
> >
> > If wish (or tclsh) is combined with c using the load command, you may
> > use a starpack.
> > Then, you only have to compile your c extension and any C compiler may
> > be used for this task.
> > Afterwars, you may bind the .tcl and .c files to a precompiled wish/
> > tclsh exe of any version.
> >
> > http://wiki.tcl.tk/starkit
> >
> > Hope this helps,
> > Harald
>
> Thank you Harald.
>
> But I didn't understand what you mean with "load command".
You create an 'extension' coded in C/C++. Assuming you have actual
C/C++ code as part of your application. If your application is *purely*
coded in Tcl, you don't need to do this. You use the SDX 'kit' along
with a suitable Tclkit to create a StarPack.
> Years ago it was so simple to combine C and tcl thanks to mktclapp.
> Recently for a pure tcl application a tried freewrap, but the code was
> not portable to another PC, the were problems with paths, that I never
> could resolve (Document is not clear)
Freewrap is a early, somewhat primitive forerunner to StarPack's.
>
> What is crazy, is that it is so complicate to convert a simple tcl
> code, in a executable
With StarPack technology, it has become very easy.
>
> All the way, many thanks, and if you could have some tricks, I would
> appreciate
If you want some examples of how to work with SDX, Tclkits, and these
utilities to create StarPack, check out Deepwoods Software's Model
Railroad System -- this package uses this technology quite successfully
and painlessly. The URL is in my signature.
>
> Christian
>
--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
hel...@deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/
Make a c extension to tcl.
Compile it will give you a dll
Create a tcl file which loads the extension using: "load
<filename>.dll".
Prepare a folder "app.vfs" including: main.tcl, lib.dll
Download a tclkit.exe and a tclsh.exe and sdx.kit
Execute (I use batch files):
tclkitsh857.exe sdx.kit wrap app.exe -runtime tclkit857.exe
Contents of main.tcl:
package require starkit
load [file join $starkit::topdir app.dll]
... any following code
> Years ago it was so simple to combine C and tcl thanks to mktclapp.
I am sorry, I can imagine, it is no fun if something does not work any
more.
> Recently for a pure tcl application a tried freewrap, but the code was
> not portable to another PC, the were problems with paths, that I never
> could resolve (Document is not clear)
I first used freewrap either. Anyway, I have a setup with starpacks,
wich:
- uses a wish interpreter for development.
- may be transfered into windows, ce and linux executeables using sdx
- may use tcl, dll and so files
The magic is to have all files in a folder "appname.vfs" and have a
small starter wrapper for each mode which sets folder names into
global variables (only for advanced functionality).
It is relatively complicated to understand the starpack system:
Example:
Developpment in :myapp.vfs -> files: myapp.vfs/main.tcl, myapp.vfs/
lib.dll, ...
Wrapped into: myapp.exe (Windows) myapp (Linux)
Now we rename the exe file to "beauty.exe" and move it to "C:\test
\" (only for demonstration what happens).
When the application is started, tcl sees its own files with the
following paths:
C:/test/beauty.exe/main.tcl
C:/test/beauty.exe/lib.dll
The variable $starkit::topdir contains "C:/test/beauty.exe".
If the file "main.tcl" is started by a normal wish, "package require
starkit" will fail.
So you need a mechanism to make this mode working too (for example by
checking, if package starkit is available:
if {[catch {package require starkit} ] } {
set rootdir .
} else {
set rootdir $starkit::topdir
}
load [file join $rootdir app.dll]
> What is crazy, is that it is so complicate to convert a simple tcl
> code, in a executable
I am sorry if you feel frustrated.
Regards,
Harald
And of course, the point of mktclapp is that you didn't have to go thru the
hassle of figuring out how to create an extension, which made it so easy.
> Assuming you have actual
> C/C++ code as part of your application. If your application is *purely*
> coded in Tcl, you don't need to do this. You use the SDX 'kit' along
> with a suitable Tclkit to create a StarPack.
>
>> Years ago it was so simple to combine C and tcl thanks to mktclapp.
>> Recently for a pure tcl application a tried freewrap, but the code was
>> not portable to another PC, the were problems with paths, that I never
>> could resolve (Document is not clear)
>
> Freewrap is a early, somewhat primitive forerunner to StarPack's.
Unfortunately Tclkit is not (last time I checked) distributed in the form
of nice source tarball, which is all right if you can use one of the
pre-built binaries, but good luck if you want to use on an "unusual"
platform.
>> What is crazy, is that it is so complicate to convert a simple tcl
>> code, in a executable
>
> With StarPack technology, it has become very easy.
*If* you're on the right platform.
--
Will
There is a *broad* selection of tclkits available for download. What
platform is missing? I know that Win32, MacOSX Universal (ppc +
x86_64), Linux x86 (32-bit), and Linux X86_64 (64-bit) are all
available. Plus BSD (x86[_64]) and Solaris as well. Are you targeting
Linux-ARM or something? You don't need to compile the tclkit itself.
If you have C/C++ code you create an extension, compiling it against the
tcl/tk stub libraries, using the tcl.h and tk.h files. This is done
with the TEA framework. Or you might use SWIG or some combination of
the two. Then the tcl code, the .dll/.so files, with pgkIndex.tcl files
are bundled up with the sdx utility and presto, a nice fat
self-contained executable.
Check again -- there is a TclKit build, check KBS (see
http://wiki.tcl.tk/23813).
--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
It seems that I have to try Tclkit, and unfortunately give up the way
mktclapp :-((
Relative to
> > And of course, the point of mktclapp is that you didn't have to go thru the
> > hassle of figuring out how to create an extension, which made it so easy.
I don't understand why the solution mktclapp, which was so easy to
use, has been given up :-((
Regards
Christian
Ohooooo, :-)))))))
I just discover that:
http://www.softpedia.com/get/Programming/Other-Programming-Files/Mktclapp.shtml
Has any body tested ??
I will test is asap ....
Christian
Excuse me, unfortunately, it is the same version as: http://www.hwaci.com/sw/mktclapp/
I was duped, about
the date:: Last update, March 13th, 2008, 23:32 GMT [view history],
and
the author: Eric Taylor
Over the years, I've seen many pieces of code used within the Tcl
community eventually grow stale and become unusable by a segment of
the community. Typically the issue is a change in priority by the
creator of the code.
Occasionally, some other person will come along to revitalize a
package, but that is the exception rather than the rule.
And, in a few cases, the attempts to revitalize the package also run
into prioritization issues (or conflict with the original author) and
turn quiet.
Several things have occurred since mktclapp. The community of that
package was not highly visible, the creator of freewrap was pretty
visible for a while. The tclkit/starpack community was pretty active
for a while.
Because the tclkit/starpack method did not require a person to have an
installed compiler to build applications, it seemed to gather more
users than the other technologies.
Despite the historical reasons, none of this would prevent someone
from picking up mktclapp if they wanted to see things improved.
However, it would require that person to either do the work, or to at
least entice someone else to do the work in some way. Typically, the
tcl community has more than enough projects to keep it busy, so there
are not a lot of people sitting around looking for some old code to
improve.
I'm certain that if there is someone reading this usenet group who has
an interest in working with you to improve things, they will let you
know.
QNX4.
> You don't need to compile the tclkit itself.
> If you have C/C++ code you create an extension, compiling it against the
> tcl/tk stub libraries, using the tcl.h and tk.h files. This is done
> with the TEA framework. Or you might use SWIG or some combination of
> the two. Then the tcl code, the .dll/.so files, with pgkIndex.tcl files
> are bundled up with the sdx utility and presto, a nice fat
> self-contained executable.
And if you're not on one of the supported platforms, none of this easy.
QNX4 doesn't (easily) support creation of .dll/.so files, for example.
--
Will
OK - I checked, but I don't see what I would like to see - a nice source
tarball (e.g., "tclkit-src.tar.gz"). Wrong URL or misunderstanding?
--
Will
Perhaps it was an oblique reference to the kbs script, which when
executed on a system with internet, will fetch all the source
necessary to build a tclkit-like executable suitable for building
stand alone applications.
What is the actual error/problem that you are seeing ?
You might just need to tweak the compiler options a little...
Shaun
HTH
rene
tcl/tk8.5.7 has been compiled without issue with MinGw
as mktclapp.c
when I test the hello.tcl example in: http://www.hwaci.com/sw/mktclapp/mktclapp.html
I got
make
mktclapp -f hello.mta > hello.c
mktclapp -header > hello.h
gcc -c hello.c -o hello.o \
-I. -I/opt/tcl/include -I/opt/tcl/include/X11
hello.c:1818: warning: initialization from incompatible pointer type
hello.c: In function `Et_DoInit':
hello.c:2051: warning: passing arg 3 of `Tcl_CreateCommand' from
incompatible pointer type
hello.c:2064: warning: passing arg 3 of `Tcl_CreateCommand' from
incompatible pointer type
hello.c:2089: warning: passing arg 3 of `Tcl_CreateCommand' from
incompatible pointer type
hello.c: In function `Et_Local_Init':
hello.c:2152: warning: passing arg 2 of `Tcl_Merge' from incompatible
pointer type
gcc hello.o -o hello.exe \
-L/opt/tcl/bin -ltcl85 -ltk85 -lm -mwindows
hello.o:hello.c:(.text+0x2200): undefined reference to
`TclStatInsertProc'
hello.o:hello.c:(.text+0x220c): undefined reference to
`TclAccessInsertProc'
hello.o:hello.c:(.text+0x2218): undefined reference to
`TclOpenFileChannelInsertProc'
collect2: ld returned 1 exit status
make: *** [hello.exe] Error 1
You can find the example under: http://dl.free.fr/getfile.pl?file=/V0VWg9Gi
Many thanks in advance
Yes, it was a reference to the KBS script. I assumed the OP could/would
follow links and try it -- seems that is not really the case.
From the release notes of Tcl 8.5.0
https://sourceforge.net/project/shownotes.php?release_id=562516 :
"Issues for users of the private interfaces:
...
* The pre-8.4 private interface hooks into Tcl's filesystem support have
been removed. Extensions and programs are expected to have migrated
to Tcl 8.4's public Tcl_Filesystem interface."
--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
Note, please, that mktclapp's creator didn't just *leave*, he
moved (mostly) to TOBE <URL: http://wiki.tcl.tk/tobe >.
Unfortunately TOBE is former that mktclapp :-(((
I think you are probably referring to me rather than the OP, but why do
think I didn't? I did indeed try it and doesn't run. There are various
errors but probably the critical one is not being able to find cvs. True
enough, the system I'm on doesn't have cvs. So, while kbs/tclkits may be
"easy" for common platforms, it requires jumping through hoops on others.
What would be good is if it were packaged in a nice source tarball, as I
said.
--
Will
For case B ou always need to call '/your/path/o/tclsh kbs.tcl' and or
case A
just './kbs.tcl'. I imply se case A now.
1. Get a list of available packages:
.kbs.tcl list
2. Get the sources of the needed packages:
./kbs.tcl -r sources ...
p.e. all sources to build kbskit's and tksqilte executables:
./kbs.tcl -r sources kbskit8.5 tksqlite0.5.8
3. Create your tarball:
tar cf your_tarball.tar sources kbs.tcl
Please always include tcl/tk and kbskit sources. The above example
should be enough.
HTH
rene
If you have at least one computer with compiler, cvs an
>
> --
> Will