Hello out there,
I used to build and use DLLs regularly - about 15 to 20 years ago, and
now I am not quite sure how to do it. I create a function 'initTcl'
which is called by 'main' like this
error = initTcl(argv[0]);
practically immediately. It looks like this:
---
int initTcl(char* argv0) {
TclpSetInitialEncodings();
Tcl_FindExecutable(argv0);
ourInterp = Tcl_CreateInterp();
if (Tcl_Init(ourInterp) != TCL_OK) {
return TCL_ERROR;
}
return TCL_OK;
}
---
'argv0' is well the name of my program. It fails in 'FindExecutable'
with the error
'Exception thrown at 0x0000000000000000 in StmtParserExe.exe'
Q: What is wrong in 'initTcl'?
I am on Windows using Visual Studio and a .lib file and a 64 bit DLL
from Ashok.
Any help will be greatly appreciated
Helmut
voidspot on, that was it. Many thanks to you and to Dave and Harald of
Tcl_FindExecutable(
const char *argv0) /* The value of the application's argv[0]
* (native). */
{
TclInitSubsystems();
TclpSetInitialEncodings();
TclpFindExecutable(argv0);
}
So just do as the manpage says, get rid of the TclpSetInitialEncodings()
and only call Tcl_FindExecutable(argv0).
Hallo Ralf,Hi, for what it worth (and maybe it can help) here's mine:
void
Tcl_FindExecutable(
const char *argv0) /* The value of the application's argv[0]
* (native). */
{
TclInitSubsystems();
TclpSetInitialEncodings();
TclpFindExecutable(argv0);
}
So just do as the manpage says, get rid of the TclpSetInitialEncodings() >and only call Tcl_FindExecutable(argv0).spot on, that was it. Many thanks to you and to Dave and Harald of
course, too. Now my program crashes well into its main parts - but
that's a different story :(
Best regards
Helmut
#ifdef WIN32<snip>
int wmain(int argc, wchar_t **argv) {
/*
use fflush(NULL) to reset everything in case of crashes
*/
fflush(NULL);
#else
int main (int argc, char* argv[]) {
#endif
//mainLoopcalling Tcl_Main (or Tk_Main) is good if Tcl is the base of your
Tk_Main(argc, argv, Tk_AppInit);
exit(EXIT_SUCCESS);
}
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 485 |
Nodes: | 16 (2 / 14) |
Uptime: | 131:38:55 |
Calls: | 9,655 |
Calls today: | 3 |
Files: | 13,707 |
Messages: | 6,166,572 |