1

I am trying to generate a standalone executable from a single tcl file. I am using the method using tclkit.exe mentioned in http://wiki.tcl.tk/11861.

The problem is the tcl file uses 3 packages.

package require Tk
package require tcom
package require Img

I was not able to successfully add the packages in lib folder of the generated vfs folder. Whenever I click the exe it says, failed to load tcom.dll.

Btw, there are lot of different version of activestate tcl and tclkit.exe based on x86 and x64 system. I am doing the whole thing in a 64 bit win7 system. What am I doing wrong? please help.

Codename_DJ
  • 553
  • 1
  • 11
  • 40
  • When you say you weren't successful in adding the packages, did you copy the required files manually there but it still does not work or are you unsure what files you need to copy there? – Jerry Oct 01 '15 at 09:56
  • FYI, Tclkit includes Tk already, but the other two need to be added in. – Donal Fellows Oct 01 '15 at 10:13
  • @jerry, I copied whole tcom folder from tcl/lib directory to the myapp.vfs/lib directory. tcom package contains a dll. and the error is "failed to load tcom.dll" – Codename_DJ Oct 01 '15 at 10:19
  • @donal, yeah. I also thought that. Btw is Img package a part of Tk ? http://wiki.tcl.tk/1404 N.B: I just used this line for image: set retVal [catch {image create photo -format window -data $canvId} ph] – Codename_DJ Oct 01 '15 at 10:26
  • I think I read somewhere that the latest tcom does not run on x64 [see here](https://groups.google.com/forum/#!topic/comp.lang.tcl/qM6LuT9ZM-A). Have you got an x64 version? Otherwise, `Img` libraries has to be copied as well if you use png, jpeg and other image formats. – Jerry Oct 01 '15 at 10:41
  • @jerry, I have downloaded from http://www.vex.net/~cthuang/tcom/. I am using a 32bit version of activetcl. Copied the tcom folder in c:/tcl/lib folder. The tcl file was working fine in a win7 64 bit system, when run locally. All problem starts when I have wanted to create the exe. – Codename_DJ Oct 01 '15 at 11:00
  • @Codename_DJ Ok, are the tclkit and sdx 32bit as well? – Jerry Oct 01 '15 at 11:04
  • tclkit is 32 bit for sure. I dont know about sdx.kit though. – Codename_DJ Oct 01 '15 at 11:19
  • Is the package tkImg ( http://sourceforge.net/projects/tkimg/ ) is the Img package, or something else. If not then can anyone please give a link to Img package. – Codename_DJ Oct 01 '15 at 11:22
  • As per the comments, I again downloaded 32 bit tcom, 32 bit tclkit . I have ActiveTcl8.5.15.0.297577-win32-ix86-threaded version installed in my another win7 64 system. This time the generated exe is opening unlike last time,where it was getting stuck during package importing. But after execution I am getting strange error. Looks like tcom package was not working properly. ----- 0x800401f3 {Invalid class string} 0x800401f3 {Invalid class string} while executing "::tcom::ref createobject Excel.Application" ------ Any Idea ? – Codename_DJ Oct 01 '15 at 11:37
  • 1
    Awesome that it is loading. I'm afraid that I cannot help much on that new issue :( Maybe @DonalFellows could share some insight? – Jerry Oct 01 '15 at 11:48
  • I don't know if can help, but when you include a package you have to specify manually the new path: executing the script, tcl find all necessary package searching in theirs paths but when you copy locally a package so to include it, you have to load the path adding it at the top of your script (see variable help in active tcl for the exactly name of variable). –  Oct 01 '15 at 21:59
  • {Invalid class string} sounds like an error I remember seeing when I was working with tcom. I think that means that your configuration problems are done and it's time to move to code debug mode. Check the .idl of your target DLL to verify you're using the right accessors, and remember that you can't pass structs or classes across language boundaries. – Erik Johnson Oct 05 '15 at 19:37
  • @ErikJohnson, yes, I solved the issue. Actually the code was written on different pc where excel was installed. But I was running it on a sytem where the excel application was not working, thats why this error was coming. Btw the initial isssue was solved by downloading and installing the 32 bit activetcl, 32 bit tcl kit with compatible version. and a 32 bit tcom package. – Codename_DJ Oct 13 '15 at 15:32

0 Answers0