|
2010-09-30
| ||
| 02:23 | • Closed ticket [941042ffff]: Remove TCL_STORAGE_CLASS monkey business plus 6 ... artifact: f8528cf58b user: sf-robot | |
|
2010-08-14
| ||
| 03:27 | • Pending ticket [941042ffff]. artifact: b3ae782f87 user: hobbs | |
|
2005-02-02
| ||
| 09:54 | • Ticket [941042ffff]: 4 changes artifact: 0c48a72c06 user: nobody | |
| 07:43 | • Ticket [941042ffff]: 4 changes artifact: e3a0ce41b9 user: hobbs | |
|
2004-04-24
| ||
| 05:53 | • Ticket [941042ffff]: 1 change artifact: 95f654e6ee user: jenglish | |
| 05:52 | • Add attachment sampleextension-monkey-business.patch to ticket [941042f... artifact: 6f335be33c user: jenglish | |
| 05:52 | • Ticket [941042ffff] Remove TCL_STORAGE_CLASS monkey business status still Op... artifact: f21afb0af5 user: jenglish | |
|
2004-04-23
| ||
| 22:52 | • New ticket [941042ffff]. artifact: 757ca373a5 user: jenglish | |
Remove TCL_STORAGE_CLASS monkey business
Closed / Wont Fix941042ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 16 years ago
Descriptionplain2004-04-23 22:52:35
The attached patch replaces the (confusing, and incorrect) preprocessor gyrations: #ifdef BUILD_sample #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT #endif with the usual Windows idiom, defining a distinct SAMPLE_STORAGE_CLASS macro instead of hijacking Tcl's EXTERN macro.
jenglishplain2004-04-24 05:52:35
File Added - 84863: sampleextension-monkey-business.patch
jenglish Ticket [941042ffff]: 1 change
[History diff]2004-04-24 05:53:42
hobbsplain2005-02-02 07:43:25
Logged In: YES user_id=72656 What is incorrect about the current incantations?
nobodyplain2005-02-02 09:54:32
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.
hobbsplain2010-08-14 03:27:59
See also 2025889. We do need to separate the BUILD_$pkg variants in case one TEA extension depends on another (includes it's .h), which also means we'd need the $pkg_STORAGE_CLASS. The problem I have with this proposal is that it requires changes on several lines, rather than the single BUILD_$pkg in a .h file that is currently needed. Can someone convince me this is a better approach?
sf-robotplain2010-09-30 02:23:04
This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.
Attachments:
- sampleextension-monkey-business.patch [download] added by jenglish on 2004-04-24 05:52:35. [details]