loading home made shared library vs names - TCL
This is a discussion on loading home made shared library vs names - TCL ; I've built a shared library library called libmytcl.so
I have the appropriate (I thought) init procedure: MyTcl_Init
When I try to load the library into my script, I get the error:
couldn't find procedure Mytcl_Init
I had to change the ...
-
loading home made shared library vs names
I've built a shared library library called libmytcl.so
I have the appropriate (I thought) init procedure: MyTcl_Init
When I try to load the library into my script, I get the error:
couldn't find procedure Mytcl_Init
I had to change the name of my init procedure to get it to work.
What're the rules on the naming conventions, so that the package
require will "guess right?"
I'm using tcl8.4 on linux
Thanks
-
Re: loading home made shared library vs names
The docs for "load" have the pertinent details:
"For normal interpreters the name of the initialization procedure will
have the form pkg_Init, where pkg is the same as packageName except
that the first letter is converted to upper case and all other letters
are converted to lower case. For example, if packageName is foo or
FOo, the initialization procedure's name will be Foo_Init.
http://www.tcl.tk/man/tcl8.5/TclCmd/load.htm
-Ahran
On Aug 1, 3:43 pm, Michele <e...@jlab.org> wrote:
> I've built a shared library library called libmytcl.so
> I have the appropriate (I thought) init procedure: MyTcl_Init
>
> When I try to load the library into my script, I get the error:
> couldn't find procedure Mytcl_Init
> I had to change the name of my init procedure to get it to work.
> What're the rules on the naming conventions, so that the package
> require will "guess right?"
>
> I'm using tcl8.4 on linux
> Thanks
-
Re: loading home made shared library vs names
Michele wrote:
> I've built a shared library library called libmytcl.so
> I have the appropriate (I thought) init procedure: MyTcl_Init
>
> When I try to load the library into my script, I get the error:
> couldn't find procedure Mytcl_Init
> I had to change the name of my init procedure to get it to work.
> What're the rules on the naming conventions, so that the package
> require will "guess right?"
>
> I'm using tcl8.4 on linux
> Thanks
[package require] eventually calls [load] to actually load the library.
From the load.n manpage:
"For normal interpreters the name of the initialization procedure will
have the form pkg_Init, where pkg is the same as packageName except that
the first letter is converted to upper case and all other letters are
converted to lower case. For example, if packageName is foo or FOo, the
initialization procedure's name will be Foo_Init."
and
"If packageName is omitted or specified as an empty string, Tcl tries to
guess the name of the package. This may be done differently on different
platforms. The default guess, which is used on most UNIX platforms, is
to take the last element of fileName, strip off the first three
characters if they are lib, and use any following alphabetic and
underline characters as the module name. For example, the command [load
libxyz4.2.so] uses the module name xyz and the command [load bin/last.so
{}] uses the module name last."
-- Neil
Similar Threads
-
By Application Development in forum RUBY
Replies: 1
Last Post: 12-12-2007, 03:23 PM
-
By Application Development in forum Software-Testing
Replies: 3
Last Post: 05-30-2007, 05:12 AM
-
By Application Development in forum Adobe Premiere
Replies: 0
Last Post: 12-09-2004, 05:45 AM
-
By Application Development in forum Java
Replies: 9
Last Post: 02-29-2004, 07:40 AM
-
By Application Development in forum Graphics
Replies: 0
Last Post: 09-11-2003, 01:00 AM