problem with adding a package, couldn't find procedure Isqltcl_Init 
Author Message
 problem with adding a package, couldn't find procedure Isqltcl_Init

I'm still pretty new at Tcl (I haven't done much with it in several
months).  My customers have decided that they no longer want to use
a flatfile to communicate with the database (Informix), they want Tcl
to do it directly.  We finally got isqltcl to compile, link and _almost_
load.  Notice I said almost!

It (Tcl/Tk) is complaining about "couldn't find procedure Isqltcl_Init".
I can't find Isqltcl_Init referenced in the Isqltcl sources anywhere, so
where is this coming from?  Doing a grep -i init * yields a dozen or so
references in index.txt of "Initial import of", 3 references in the
isqltcl3.1.README file and 1 reference in tclsql.c -
int Isql_Init(Tcl_Interp *interp) --- the last reference looks
interesting, but I don't think that's the problem.

Is this more an issue of packages or one of Informix (more the former
than the latter would be my uneducated guess), but since I'm out of
ideas for the afternoon, I'm looking for help elsewhere.

I'm having problems with some newsgroups (seeing some threads, it's
confusing).

--
Take care      |   This clown speaks for himself, his job doesn't
Wayne D.       |   pay for this, etc. (directly anyway)



Sun, 21 Mar 2004 03:50:37 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init
Hi Wayne,

Quote:
>It (Tcl/Tk) is complaining about "couldn't find procedure Isqltcl_Init".
>I can't find Isqltcl_Init referenced in the Isqltcl sources anywhere, so
>where is this coming from?  Doing a grep -i init * yields a dozen or so
>references in index.txt of "Initial import of", 3 references in the
>isqltcl3.1.README file and 1 reference in tclsql.c -
>int Isql_Init(Tcl_Interp *interp) --- the last reference looks
>interesting, but I don't think that's the problem.

well, I would think that this is *exactly* the problem: This is the
function Tcl needs. (If you look into what this function does, you'll
probably find calls to 'Tcl_Create[Obj]Command' and 'Tcl_PkgProvide' -
really important stuff).
This function does need to be *exported* to be visible from the
outside (by Tcl). How you can assure this depends on your platform, on
Windows it is usually something like
   DLL_EXPORT int Isql_Init( Tcl_Interp *interp)
where DLL_EXPORT is
   #define DLL_EXPORT __declspec(dllexport)

HTH
Helmut



Sun, 21 Mar 2004 04:23:59 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init

Quote:
> It (Tcl/Tk) is complaining about "couldn't find procedure Isqltcl_Init".
...
> ... and 1 reference in tclsql.c -
> int Isql_Init(Tcl_Interp *interp) --- the last reference looks

OK, so the [load] command is looking for the wrong procedure name.
Try replacing [load $filename] with [load $filename Isql].

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Sun, 21 Mar 2004 04:42:56 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init

Quote:

> OK, so the [load] command is looking for the wrong procedure name.
> Try replacing [load $filename] with [load $filename Isql].

And then complain to the author(s) of Isql about the bug.

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Sun, 21 Mar 2004 04:43:42 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init


Quote:
> I'm still pretty new at Tcl (I haven't done much with it in several
> months).  My customers have decided that they no longer want to use
> a flatfile to communicate with the database (Informix), they want Tcl
> to do it directly.  We finally got isqltcl to compile, link and _almost_
> load.  Notice I said almost!

> It (Tcl/Tk) is complaining about "couldn't find procedure Isqltcl_Init".
> I can't find Isqltcl_Init referenced in the Isqltcl sources anywhere, so
> where is this coming from?

You have answered the question already. Nowhere from. And that is the
problem.
When Tcl is loading a compiled package "foo" it does expect that this
package
defines, implements and exports a function "Foo_Init". Tcl wants this
function so
that it can initialize the compiled package.

Where in the sources does Isqltcl register its tcl commands with the
interpreter ?
I ask because that function might be a candidate for Isqltcl_Init, or should
be called
from it. Look at other packages like OraTcl and TclX as examples

  Doing a grep -i init * yields a dozen or so

Quote:
> references in index.txt of "Initial import of", 3 references in the
> isqltcl3.1.README file and 1 reference in tclsql.c -
> int Isql_Init(Tcl_Interp *interp) --- the last reference looks
> interesting, but I don't think that's the problem.

Oh, I believe it is. This is hopefully the initialization function for all
of Isqltcl.
The problem is that it has the wrong name. Rename this to Isqltcl_Init and
you should be fine.

Quote:
> I'm having problems with some newsgroups (seeing some threads, it's
> confusing).

--




Sun, 21 Mar 2004 05:45:51 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init

Quote:

>>It (Tcl/Tk) is complaining about "couldn't find procedure Isqltcl_Init".
>>I can't find Isqltcl_Init referenced in the Isqltcl sources anywhere, so
>>where is this coming from?  Doing a grep -i init * yields a dozen or so
>>references in index.txt of "Initial import of", 3 references in the
>>isqltcl3.1.README file and 1 reference in tclsql.c -
>>int Isql_Init(Tcl_Interp *interp) --- the last reference looks
>>interesting, but I don't think that's the problem.
> well, I would think that this is *exactly* the problem: This is the
> function Tcl needs. (If you look into what this function does, you'll
> probably find calls to 'Tcl_Create[Obj]Command' and 'Tcl_PkgProvide' -
> really important stuff).

The reason I said "I don't think that's the problem." is that
the package is called Isqltcl, this is specific to Tcl/Tk.  Why
would the package developers have left something that anyone
who wants to use it need to modify the developed source?  It
doesn't make a lot of sense.

But this does seem to be the consensus of the people in this
group so I'm going to try it and see what happens.  It will
probably work.

Quote:
> This function does need to be *exported* to be visible from the
> outside (by Tcl). How you can assure this depends on your platform, on
> Windows it is usually something like
>    DLL_EXPORT int Isql_Init( Tcl_Interp *interp)
> where DLL_EXPORT is
>    #define DLL_EXPORT __declspec(dllexport)

This is actually Solaris, not Windows.

--
Take care      |   This clown speaks for himself, his job doesn't
Wayne D.       |   pay for this, etc. (directly anyway)



Sun, 21 Mar 2004 19:11:57 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init
still not sure what I'm doing with exending Tcl/Tk, sys admin
is in the same boat (WRT Tcl) ...

Okay, past the "no Isqltcl_Init module" - (hmmm, sounds like
a Mario game - got the hat, got the coins, etc.<g>), now it's
telling me it can't find the package Isqltcl?  See below:
$ tclsh8.3
% package require Isqltcl
can't find package Isqltcl
% package require ISqlTcl
can't find package ISqlTcl
% package require limit
1.0
% package require tbcload
1.3
% exit

That's the same error I recieve if I try:
package require dlmnfdlnln
 (yes I know there is no such name, just verifying to myself that
  the errors would be the same)

Here is the directory entries:
/opt/TclPro1.4/solaris-sparc/lib
$ ls -l
total 12109
 <snip>
drwxr-x---+  2 root          512 Oct  2 14:14 isqltcl3.1
 <snip>
-rwxr-xr-x   1 root        50200 Oct  3 07:36 libisqltcl.so
 <snip>

the contents of pkgIndex.tcl:
# Tcl package index file, version 1.0
# This file is sourced either when an application starts up or
# by a "package unknown" script.  It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands.  When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded Isqltcl 3.1 [list load [file join $dir .. libisqltcl.so] Isqltcl]

and that directory entry:
/opt/TclPro1.4/solaris-sparc/lib/isqltcl3.1
$ ls -l
total 1
-rwxr-xr-x+  1 root          504 Oct  3 07:47 pkgIndex.tcl

--
Take care      |   This clown speaks for himself, his job doesn't
Wayne D.       |   pay for this, etc. (directly anyway)



Sun, 21 Mar 2004 20:26:21 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init

Quote:
>Okay, past the "no Isqltcl_Init module"

I take that to mean that there is now a function named
Isqltcl_Init().  You've corrected the name.

Quote:
> $ tclsh8.3
> % package require Isqltcl
> can't find package Isqltcl

In the function Isqltcl_Init(), is there a call to
Tcl_PkgProvide() ?  What are the arguments in that call?

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Sun, 21 Mar 2004 21:47:43 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init

Quote:


>>Okay, past the "no Isqltcl_Init module"
> I take that to mean that there is now a function named
> Isqltcl_Init().  You've corrected the name.

Correct.

Quote:
>> $ tclsh8.3
>> % package require Isqltcl
>> can't find package Isqltcl
> In the function Isqltcl_Init(), is there a call to
> Tcl_PkgProvide() ?  What are the arguments in that call?

/* Tcl_PkgProvide is not const-correct so these are not const variables */
static char isql_version[] = "5.00";
static char isql_package[] = "isql";

The actual usage:
int Isqltcl_Init(Tcl_Interp *interp)
{
    Tcl_CreateCommand(interp, "sql", tcl_informix_cmds,
        (ClientData)0, (void (*)())0);
#ifdef TCL_SQL_INCLUDE_TCL_SYSTEM
    Tcl_CreateCommand(interp, "tcl_system", tcl_system,
        (ClientData)0, (void (*)())0);
#endif /* TCL_SQL_INCLUDE_TCL_SYSTEM */
    Tcl_PkgProvide(interp, isql_package, isql_version);
    return TCL_OK;

Quote:
}

Being the paranoid type I am (thank you and not knowing any
better), I tracked down interp (isql_package and isql_version
are defined above):
static int tcl_sql_usage(Tcl_Interp *interp)

So Tcl_PkgProvide is present with three parameters.

Still real confused.

- -
Take care      |   This clown speaks for himself, his job doesn't
Wayne D.       |   pay for this, etc. (directly anyway)



Sun, 21 Mar 2004 22:02:56 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init
Quote:
>/* Tcl_PkgProvide is not const-correct so these are not const variables */
>static char isql_version[] = "5.00";
>static char isql_package[] = "isql";

>The actual usage:
>int Isqltcl_Init(Tcl_Interp *interp)
>{
>    Tcl_CreateCommand(interp, "sql", tcl_informix_cmds,
>        (ClientData)0, (void (*)())0);
>#ifdef TCL_SQL_INCLUDE_TCL_SYSTEM
>    Tcl_CreateCommand(interp, "tcl_system", tcl_system,
>        (ClientData)0, (void (*)())0);
>#endif /* TCL_SQL_INCLUDE_TCL_SYSTEM */
>    Tcl_PkgProvide(interp, isql_package, isql_version);
>    return TCL_OK;
>}

>Being the paranoid type I am (thank you and not knowing any
>better), I tracked down interp (isql_package and isql_version
>are defined above):
>static int tcl_sql_usage(Tcl_Interp *interp)

Hi Wayne,
things do clear up. The call
   Tcl_PkgProvide(interp, isql_package, isql_version);
tells Tcl the name of the package, which here is "isql" via the
#define above. So you need to say "package require isql".
HTH
Helmut


Sun, 21 Mar 2004 23:30:09 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init

Quote:

>> In the function Isqltcl_Init(), is there a call to
>> Tcl_PkgProvide() ?  What are the arguments in that call?


Quote:
> static char isql_version[] = "5.00";
> static char isql_package[] = "isql";
>    Tcl_PkgProvide(interp, isql_package, isql_version);A
...
> Still real confused.

You may be confused, or the author of this package may be confused.

The C code you describe was written (originally) as if the package
should be named "isql".  Yet somehow you got the impression the name
was supposed to be "Isqltcl".  

It's time to bring in the package author and find out what s/he
intends the name of the package to be, and get that name
consistent throughout the package.

Are you the first person to ever use this package?

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Sun, 21 Mar 2004 23:34:44 GMT  
 problem with adding a package, couldn't find procedure Isqltcl_Init

Quote:


>>> In the function Isqltcl_Init(), is there a call to
>>> Tcl_PkgProvide() ?  What are the arguments in that call?

>> static char isql_version[] = "5.00";
>> static char isql_package[] = "isql";
>>    Tcl_PkgProvide(interp, isql_package, isql_version);A
> ...
>> Still real confused.
> You may be confused, or the author of this package may be confused.
> The C code you describe was written (originally) as if the package
> should be named "isql".  Yet somehow you got the impression the name
> was supposed to be "Isqltcl".  
> It's time to bring in the package author and find out what s/he
> intends the name of the package to be, and get that name
> consistent throughout the package.
> Are you the first person to ever use this package?

No, to the best of my knowledge 4 other places use it (3 developers
and a guy I've corresponded with).  The guy I corresponded may have
been experimenting/playing more than actually using it.  I don't
know how many systems or developers this actually corresponds to.

I got the files from the sourceforge cvs location (project home page
then to the cvs location, etc.).  The project was called isqltcl,
that's why I called it isqltcl.  isql is also the name of a tool
that Informix supplies that lets users browse databases and tables
"interactively" via a text interface and chaning menus.  The
sourceforge description says the project is stable and in production,
but that they have released no files.  The original installation
process was looking for autoconf (the sysadmins have never heard of
autoconf) - eventually I got a script to do the compiling, etc.

It looks like the sample scripts are looking for isql as well.

Thanks to everybody for your assistance for this lowly newbie.

--
Take care      |   This clown speaks for himself, his job doesn't
Wayne D.       |   pay for this, etc. (directly anyway)



Mon, 22 Mar 2004 01:57:08 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. EAI: Couldn't find vrml plugin...

2. New Site (Couldn't Find It)

3. Tcl_Release couldn't find reference for 0x16e8228

4. mysqltcl: typo results in Tcl_Release couldn't find reference

5. couldn't open socket: connection refused problem

6. 'logger' package added to tcllib CVS

7. Adding a File to a Procedure's File Schematic

8. Adding Procedures to Generated Procedures

9. distutils won't add data file to package dir

10. C4: problem adding procedure?

11. I couldn't get a book on Tcl in Waterstone's

12. Expect : Problem with variable scope's in procedure's

 

 
Powered by phpBB® Forum Software