Overview
| Artifact ID: | 0c48a72c06316dd4e1dd85b832b65f1aa36d13e3 |
|---|---|
| Ticket: | 941042ffffffffffffffffffffffffffffffffff
Remove TCL_STORAGE_CLASS monkey business |
| User & Date: | nobody on 2005-02-02 09:54:32 |
Changes
- icomment:
Logged In: NO The usual convention on Windows is to define a preprocessor symbol like "XXXAPI", and use declarations like "extern XXXAPI XXX_Foo(void);", where XXXAPI expands to "__declspec(dllexport)" in source modules that are part of the library and "__declspec(dllimport)" in source modules that use the library. This is basically how <tcl.h> defines the EXTERN macro (which probably should have been called "TCLAPI" instead of "EXTERN", but that's an historical accident.) The preprocessor gyrations that Tk and the sampleextension go through aren't necessarily incorrect, but they are confusing, error-prone, and unnecessarily complicated. The #ifdef / #undef / #define / #include / #undef / #define cycle is basically hijacking Tcl's storage class macro "EXTERN" and temporarily repurposing it to mean "My package's public symbols" instead of "Tcl's public symbols". The conventional idiom would be for each extension to define its own storage class macro instead; that's what the patch does. Also, for simple extensions that are only dynamically loaded and don't export a public, non-stubbed API to dependent extensions, you don't even need to do that: just declare the _Init() routine as DLLEXPORT and it will do the right thing on all platforms.
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"