Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C in Windows: Link to TCL static library

Status
Not open for further replies.

Taher_Selim

Member level 5
Member level 5
Joined
Mar 26, 2008
Messages
83
Helped
11
Reputation
22
Reaction score
4
Trophy points
1,298
Location
Egypt
Activity points
1,801
I have downloaded TCL source from here and I can compile it to generate static library in Windows7 using the following command
Code:
nmake -f makefile.vc OPTS=static INSTALLDIR=path_to_your_install_dir
nmake -f makefile.vc install OPTS=static INSTALLDIR=path_to_your_install_dir
In the output, I can get tcl87s.lib - tcldds14s.lib - tclreg13s.lib
Now I am trying to build my C code (that has TCL embedded):
C:
static const char *user_script = "puts \"Hello World ........\"\n";

int my_cmd(Tcl_Interp *interp, const char *arg_str, ...){
  char *cmd_str = Tcl_Alloc(256);
  va_list ap;
  int result;
  va_start(ap,arg_str);
  vsprintf(cmd_str, arg_str, ap);
  result = Tcl_Eval(interp,cmd_str);
  Tcl_Free(cmd_str);
  return result;
}

int main (int argc ,char *argv[])
{
    Tcl_FindExecutable(argv[0]);
    Tcl_Interp *myinterp;
    printf ("C: Starting ... \n");
    myinterp = Tcl_CreateInterp();

    if (Tcl_Init(myinterp) != TCL_OK) {
        printf("Error: %s\n",Tcl_GetStringResult(myinterp));
        return TCL_ERROR;
    }

    if (my_cmd(myinterp, user_script) != TCL_OK) {
        printf("Error: %s\n",Tcl_GetStringResult(myinterp));
        return TCL_ERROR;
    }
    
    Tcl_DeleteInterp(myinterp);
    Tcl_Finalize();
    return TCL_OK;
}

Because I need to build it in Windows, I am compiling this code in Visual Studio Command Prompt:
Code:
cl -I"D:\path\to\tcl\include" myCode.c D:\path\to\tcl87s.lib
But unfortunately, I get always these errors:
Code:
error LNK2019: unresolved external symbol __imp__Tcl_Alloc referenced in function ...
error ....................................__imp__Tcl_Free ..................
error ....................................__imp__Tcl_CreateInterp ..................
.........and more errors for other TCL functions.......

If I built TCL as a dymanic library, no errors and I can compile my C code. Does anyone know what could be the problem
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top