Re: C++/TCL Need Solution to Compile Error c2784
- From: JesusChuyCampos@xxxxxxxxx
- Date: 16 Apr 2007 18:01:48 -0700
On Apr 15, 5:38 pm, David Gravereaux <davyg...@xxxxxxxxx> wrote:
JesusChuyCam...@xxxxxxxxx wrote:
BTW: David, The two prototypes "hand glue" are about 275 lines
(included blank lines and comments), I got 56 more to go (once I get
things working), but man!!! You had to do 88, that is a lot. Still
wishing CPPTCL would had work for me, but the MS VC++ compiler just
couldn't handle BOOST.
2.2KLOC in my scope glue and counting.. Yeah, it's long, but you get into a
groove past the first few and you'll notice you'll copy a lot of the code you
already wrote.
--
"It's great to have a friend who appreciates an earnest discussion of
ideas." -Calvin
signature.asc
1KDownload
Hi David,
Well, after many attempts I'm no longer getting compiler errors for my
C file, but a few warnings. When it tries to link, it fails. BTW:
I'm only using the "Tcl_CreateObjCommand" and not the
"Tcl_CreateCommand", which cuts the code in half.
file: jnior310tcl.c
=============================== START
//
// jnior310tcl.c
//
// The initialization procedure for a loadable package.
//
//
// Build Command
// cd "C:/Program Files/TCL_TK/tcl_c_api"
// "C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe"
jnior310tcl.c /EHs /I "C:/Program Files/Tcl/include" /I "C:/Program
Files/TCL_TK/tcl_c_api/integpg" /LD "C:/Program Files/Tcl/lib/
Tcl84.lib" /LD "C:/Program Files/TCL_TK/tcl_c_api/integpg/
jnior300.lib" > error02.txt
//
#include <tcl.h>
#include "integpg/jnior_300.h"
//#define _SCL_SECURE_NO_DEPRECATE
//#define _CRT_SECURE_NO_DEPRECATE
//
============================================================================================
//
// Declarations for application-specific command procedures
//
//
// long __stdcall Connect(char *ip, unsigned short port, long *handle,
char *user_name, char *password);
//
int ConnectObjCmd(ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[]);
//
// long __stdcall Disconnect(long handle);
//
int DisconnectObjCmd(ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[]);
//
// Jnior310tcl_Init is called when the package is loaded.
//
int Jnior310tcl_Init(Tcl_Interp *interp) {
//
// Initialize the stub table interface.
//
if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
return TCL_ERROR;
}
//
// Register one (not two0 variation(s) of Connect.
// The tclObjtclConnect command uses the object interface.
//
//
// long __stdcall Connect(char *ip, unsigned short port, long
*handle, char *user_name, char *password);
//
Tcl_CreateObjCommand(interp, "Connect", ConnectObjCmd,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
//
// long __stdcall Disconnect(long handle);
//
Tcl_CreateObjCommand(interp, "Disconnect", DisconnectObjCmd,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
//
// Declare that we implement the jnior310tcl package
// so scripts that do "package require jnior310tcl"
// can load the library automatically.
//
Tcl_PkgProvide(interp, "jnior310tcl", "1.1");
return TCL_OK;
}
//
============================================================================================
//
// jnior310tcl Project
//
//
// The ConnectObjCmd C command procedure.
// long __stdcall Connect(char *ip, unsigned short port, long *handle,
char *user_name, char *password);
//
int
ConnectObjCmd(ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *resultPtr;
int ConnectResult;
char *ip4TCL;
unsigned short port4TCL;
long handle4TCL;
char *user_name4TCL;
char *password4TCL;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 1, objv, "ip, port, handle, user_name,
password");
return TCL_ERROR;
}
if (Tcl_GetStringFromObj(interp, objv[1], &ip4TCL) != TCL_OK) {
return TCL_ERROR;
}
// Should it be Tcl_GetUnsignedShortFromObj?
if (Tcl_GetIntFromObj(interp, objv[2], &port4TCL) != TCL_OK) {
return TCL_ERROR;
}
if (Tcl_GetLongFromObj(interp, objv[3], &handle4TCL) != TCL_OK) {
return TCL_ERROR;
}
if (Tcl_GetStringFromObj(interp, objv[4], &user_name4TCL) != TCL_OK)
{
return TCL_ERROR;
}
if (Tcl_GetStringFromObj(interp, objv[5], &password4TCL) != TCL_OK) {
return TCL_ERROR;
}
ConnectResult = Connect(ip4TCL, port4TCL, handle4TCL, user_name4TCL,
password4TCL);
resultPtr = Tcl_GetObjResult(interp);
Tcl_SetIntObj(resultPtr, ConnectResult);
return TCL_OK;
}
//
============================================================================================
//
// jnior310tcl Project
//
//
// The DisconnectObjCmd C command procedure.
// long __stdcall Disconnect(long handle);
//
int
DisconnectObjCmd(ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *resultPtr;
int DisconnectResult;
long handle4TCL;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, "handle");
return TCL_ERROR;
}
if (Tcl_GetLong(interp, objv[1], handle4TCL) != TCL_OK) {
return TCL_ERROR;
}
DisconnectResult = Disconnect(handle4TCL);
resultPtr = Tcl_GetObjResult(interp);
Tcl_SetIntObj(resultPtr, DisconnectResult);
return TCL_OK;
}
=============================== STOP
ERROR/WARNING MESSAGES
=============================== START
jnior310tcl.c
jnior310tcl.c(108) : warning C4133: 'function' : incompatible types -
from 'Tcl_Interp *' to 'Tcl_Obj *'
jnior310tcl.c(108) : warning C4133: 'function' : incompatible types -
from 'Tcl_Obj *const ' to 'int *'
jnior310tcl.c(108) : warning C4020: 'Tcl_GetStringFromObj' : too many
actual parameters
jnior310tcl.c(112) : warning C4133: 'function' : incompatible types -
from 'unsigned short *' to 'int *'
jnior310tcl.c(118) : warning C4133: 'function' : incompatible types -
from 'Tcl_Interp *' to 'Tcl_Obj *'
jnior310tcl.c(118) : warning C4133: 'function' : incompatible types -
from 'Tcl_Obj *const ' to 'int *'
jnior310tcl.c(118) : warning C4020: 'Tcl_GetStringFromObj' : too many
actual parameters
jnior310tcl.c(121) : warning C4133: 'function' : incompatible types -
from 'Tcl_Interp *' to 'Tcl_Obj *'
jnior310tcl.c(121) : warning C4133: 'function' : incompatible types -
from 'Tcl_Obj *const ' to 'int *'
jnior310tcl.c(121) : warning C4020: 'Tcl_GetStringFromObj' : too many
actual parameters
jnior310tcl.c(125) : warning C4047: 'function' : 'long *' differs in
levels of indirection from 'long'
jnior310tcl.c(125) : warning C4024: 'Connect' : different types for
formal and actual parameter 3
c:\program files\tcl_tk\tcl_c_api\jnior310tcl.c(158) : warning C4700:
uninitialized local variable 'handle4TCL' used
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
/out:jnior310tcl.dll
/dll
/implib:jnior310tcl.lib
jnior310tcl.obj
"C:/Program Files/Tcl/lib/Tcl84.lib"
"C:/Program Files/TCL_TK/tcl_c_api/integpg/jnior300.lib"
jnior310tcl.obj : error LNK2019: unresolved external symbol
_Connect@20 referenced in function _ConnectObjCmd
jnior310tcl.obj : error LNK2019: unresolved external symbol
_Disconnect@4 referenced in function _DisconnectObjCmd
jnior310tcl.obj : error LNK2019: unresolved external symbol
_Tcl_GetLong referenced in function _DisconnectObjCmd
jnior310tcl.dll : fatal error LNK1120: 3 unresolved externals
=============================== STOP
.
- Follow-Ups:
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- References:
- C++/TCL Need Solution to Compile Error c2784
- From: JesusChuyCampos
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: JesusChuyCampos
- Re: C++/TCL Need Solution to Compile Error c2784
- From: Christian Gollwitzer
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: Alexandre Ferrieux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: JesusChuyCampos
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- C++/TCL Need Solution to Compile Error c2784
- Prev by Date: Re: Tcl/Tk 8.5
- Next by Date: Re: HowTo Save/Load lists To/from a file - [info complete] ?
- Previous by thread: Re: C++/TCL Need Solution to Compile Error c2784
- Next by thread: Re: C++/TCL Need Solution to Compile Error c2784
- Index(es):
Relevant Pages
|