Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-09

Problems linking to TclTk

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Eidelman

Hi,

I am attempting to construct an application with an embedded scripting language on Win32. Tcl seemed like a good candidate because you get the graphics for free. I have successfully linked to the tcl84.dll and tk84.dll that come in the Win32 Tcl install. Although the code executes reasonably well some times, I get a variety of internal error messages (usually Runtime error 217) but sometimes by trapping the exceptions I have errors referrering to access violations. The crashes are almost certainly due to memory problems since I get different results when I pass a string to Tcl from the main program rather than from a procedure, or if the length of the string being passed in changes. The errors may have something to do with finalization since I have managed to block them by inserting a HALT before the end of the main program. This only works sometimes though. I have wondered if this could be a threading issue, since Tcl and Tk create extra threads at their initialization (according to gdb).

Does anyone have experience with this type of thing. There is a package for the GNAT Ada compiler that works fine but I would rather use Pascal if possible. (My test code essentially mirrors that of the Ada package, which itself just links to the entry points in the DLLs).

Any help would be appreciated.

Thanks

David Eidelman

Unknown author

Hello

Does anyone have experience with this type of thing.

yes, when building a wrapper for the Sablotron library using CDECL procedure and PChar Parameters . As far I remember, mine was due to the fact that I must managed a string variable outside of a callback procedure and not as a local variable when converting it to a PChar passed to another procedure of the library. When not doing this the result were not the same every time and I have sporadic memory violation error depending on the size of the string and others strange issues.

Hope this helps,

Christophe

Unknown author

Why don't you use PTK.

It's and is designed for just this task.

Its open-source btw.

Ciao
A.J. Venter

Original Message:
-----------------
From:
Date: Tue, 03 Sep 2002 19:49:12 +0200 (MEST)
To:
Subject: Re: [fpc-pascal]Problems linking to TclTk

Hello

Does anyone have experience with this type of thing.

yes, when building a wrapper for the Sablotron library using CDECL procedure and PChar Parameters .
As far I remember, mine was due to the fact that I must managed a string variable outside of a
callback procedure and not as a local variable when converting it to a PChar passed to another
procedure of the library. When not doing this the result were not the same every time and I have
sporadic memory violation error depending on the size of the string and others strange issues.

Hope this helps,

Christophe