Posted to tcl by mjanssen at Fri Aug 17 11:33:04 GMT 2007view pretty
# wm.tcl hook command is defined in wm.dll hook -------------- # gen.tcl set so [open so.tcl w] set pream { proc load_dll {} { puts "loading dll" set so [open [info script] r] read $so ; fconfigure $so -translation binary read $so 1 ; # drop ^Z set dll_start [tell $so] puts $dll_start chan seek $so 0 end set dll_end [tell $so] puts $dll_end chan seek $so $dll_start set dll [read $so [expr {$dll_end - $dll_start}]] set tdll [open "test.dll" wb] puts -nonewline $tdll $dll close $tdll load "test.dll" Wm } load_dll } puts $so $pream puts -nonewline $so [read [open wm.tcl r]] fconfigure $so -translation binary puts -nonewline $so \x1A puts -nonewline $so [read [open wm.dll rb]] close $so ----- generate file with tclsh gen.tcl now start tclsh so.tcl and the dll will get loaded