From: Kevin Walzer <sw@wo...> - 2005-08-18 18:35:59
-----BEGIN PGP SIGNED MESSAGE-----
I'm trying to write a Tcl wrapper for the Carbon Help API
(AHRegisterHelpBook, AHGotoPage, etc.). Because I'm not very fluent in
C, I'm working with Swig. And I'm stuck. I get an extension generated,
but when I load the library into tclsh, after I try to run commands from
the Help API, I get an error message: "invalid command name."
Here are the steps I'm taking:
1. First, I'm writing a Swig interface file. Since I want to simply wrap
the Carbon Help API, the file is short, as follows:
2. Next, I run Swig:
swig -tcl -namespace tclAppleHelp.i
3. This generates a C file, tclAppleHelp_wrap.c. Next, I compile the file:
gcc -framework Tcl -framework Carbon -dynamiclib tclAppleHelp_wrap.c -o
4. This works. Then I move into tclsh and run this command:
That also works.
5. Then, I get stuck. I'm not sure how to invoke the functions I've
supposedly wrapped. Swig generates the tclapplehelp:: namespace, so I've
tried a few variations: "tclapplehelp::AHRegisterHelpBook" is one
example, which generates the "invalid command name" error.
These functions generally only work when called inside an app bundle, so
I don't expect to get perfect output, but the error messages indicate to
me that the functions are not being loaded in the way I thought they would.
It's quite possible I should include some other header files as well,
but I'm not sure which ones.
Any help is appreciated. Once I get this extension built and tested in
my own applications, I'll release it as open-source under a BSD-style
license, and perhaps it can be considered for inclusion in the next BI
distro. I like using the native Apple help system in my programs, but I
now have to resort to Python hacks to get the help books loaded
properly, and I'd like a cleaner interface.
Thanks in advance.
Kevin Walzer, PhD
sw at wordtech-software.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----