Re: C++/TCL Need Solution to Compile Error c2784
- From: JesusChuyCampos@xxxxxxxxx
- Date: 15 Apr 2007 00:50:16 -0700
On Apr 14, 4:24 pm, David Gravereaux <davyg...@xxxxxxxxx> wrote:
Ok, I figure-out what I was doing wrong.
proc ::tiepie::GetSerialNumber {} {
set serial [binary format [::ffidl::info format dword] 0]
set rtn [_GetSerialNumber serial]
if {[ResultERR $rtn name info]} {
return -code error -errorinfo $info -errorcode [list TIEPIE $name $info]
}
binary scan $serial [::ffidl::info format dword] serial
return $serial
}
I wasn't setting the proper size of the byte array initially. The type is a
dword, but I had it set for word by accident. This might actually work :)
For me, ffidl is not worth the time investment, as I understand how to write
extensions in C just fine.
(bin) 32 % ::tiepie::InitInstrument
(bin) 33 % ::tiepie::GetSerialNumber
11740
^- Correct behavior!
now I unplug the unit to check for proper error return:
(bin) 34 % catch {::tiepie::GetSerialNumber}
(bin) 35 % 1
(bin) 36 % set errorInfo
Hardware is not connected
invoked from within
"::tiepie::GetSerialNumber"
(bin) 36 % set errorCode
TIEPIE E_NO_HARDWARE {Hardware is not connected}
^- Correct behavior!
So far, there are some limits I see. One particular function I want to use takes
a HANDLE type of a win32 waitable event. There is no such way to use ffidl for
such a thing as it is too low-level. I could abstract such a command, but then
I'm writing it in C anyways..
I could complete this library using ffidl, but I'd have to use the polling method
for event checking which would be lossy in terms of performance.
--
"It's great to have a friend who appreciates an earnest discussion of
ideas." -Calvin
signature.asc
1KDownload
Well, I guess my post from Friday Night (or was it Saturday Morning)
didn't go through. Well David, you may win the bet. I found my old
Brent Welch's book and looked at his example and yours to get an idea
how the TCL C API works. I think I have a handle of it. Got concern
when I could find a Tcl_Get???FromObj for unsigned short, unitl I
noticed you provided a link for the TCL Library. After sum reading, I
noticed that Tcl_GetIntFromObj should do it. So far I'm only
attempting to "hand glue" the code for 'Connect' and 'Disconnect'
prototypes. If I can get this to work, (To Compile, to Load and talk
to the device without any crashes) would be a major relief. I'm still
getting some errors but I'm trying to resolve them (forcing me to re-
learn C again). But if I can't get it to work, I plan to post it
somewhere and see if someone can tell me what the hell I'm doing. I
been so spoiled by TCL, BASH, and C-SHELL, that I totally forgot the
concept of character arrays.
Question: Brent's book mentions to build two prototypes and
definitions:
Tcl_CreateCommand
Tcl_CreateObjCommand
Should I bother to create both?
Question: The second arguement (parameter) for the function
Tcl_CreateObjCommand; is this the name of the command that I will use
via TCL, to call the C Function?
Question: I'm getting a few of these warnings: "jnior310tcl.c(215) :
warning C4020: 'Tcl_GetStringFromObj' : too many actual parameters"
The examples I found, use three parameters but the "tcl.h" defines the
protoype with only two parameters. Should I been concern? And What
the Hell! passing two arguements when it expects two! This warning
message also applies to other Tcl_GetXXXXX calls.
Question (last one): Posting the project for someone to take a crack
at the 'Connect' and 'Disconnect' prototypes to much?
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.
.
- Follow-Ups:
- Re: C++/TCL Need Solution to Compile Error c2784
- From: David Gravereaux
- Re: C++/TCL Need Solution to Compile Error c2784
- From: Kevin Kenny
- 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
- C++/TCL Need Solution to Compile Error c2784
- Prev by Date: tclsoap errors on solaris/linux
- Next by Date: Re: C++/TCL Need Solution to Compile Error c2784
- 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
|
|