Version 3 of Building an extension for Tcl under Mac OS X

Updated 2004-11-09 04:17:50 by DAS

Use TEA, but perhaps also see "Hello World as a C extension".

aricb I hope someone will fill in a few more details here. Some questions I have are:

What are the popular compilers used for Tcl extensions on OS X? What Mac-specific compiler arguments should an extension writer be familiar with?

The MacOS X page mentions that Tk can be compiled to have a native Aqua look and feel, or it can be compiled to use X-Windows. Does an extension writer need to worry about this distinction, and if so, what does one do differently in each case?

---

  • generally the compiler to use on MacOS X is gcc, which comes with the system. There are commercial compilers available as well if you have special requirements.
  • If you use recent TEA, as an extension builder you do not need to know whether you are building against TkAqua or TkX11, TEA will extract this info from the tkConfig.sh file. However, if you use X11 calls in your code, the resulting binary will be tied to the Tk variant you built against and will not load or crash if loaded in the other variant of Tk (best to check tk windowingsystem in pkgIndex.tcl before loading). This is because the extensions built against TkAqua will use emulated X11 calls whereas the other one will use real X11.

[DAS]