digitalmars.D - Request: "noexport" attribute
- Michael Butscher (33/33) Jun 07 2005 Hi,
- Uwe Salomon (6/11) Jun 07 2005 AFAIK, this will not work as you expect! version() is not the same as
- Vathix (4/15) Jun 07 2005 Sometimes { } doesn't introduce a new scope, depending on the statement....
- Michael Butscher (3/16) Jun 08 2005 I tried it and it works (tested with DMD 0.124).
- Chris Sauls (31/36) Jun 07 2005 Since 'export' is a protection attribute, you can end any 'export:'
- Michael Butscher (3/28) Jun 09 2005 Thank you!
Hi, the problem I want to solve is that some functions should be exported to a DLL (or not) based on a version identifier. This probably could be done also by editing the .def file but would be rather inconvenient. Example: ---------- version(DLL_C) // If we want a DLL interface for C { export: extern(C): } int forC_aaa() {...} int forC_bbb() {...} noexport: // Stop exporting extern(D): // Stop C linkage int helper() // Never exported {...} version(DLL_D) // If we want a DLL interface for D { export: } int aaa() {...} int bbb() {...} noexport: // Stop exporting ---------- It would be nice also if it could be written this way: version(DLL_D) {export} int aaa() But maybe hard to implement. Michael
Jun 07 2005
version(DLL_C) // If we want a DLL interface for C { export: extern(C): }AFAIK, this will not work as you expect! version() is not the same as #ifdef and friends, where you "include" something. The scope of export: and extern: ends at the closing brace! Anything after version() will have the normal D linkage. Ciao uwe
Jun 07 2005
On Tue, 07 Jun 2005 15:30:14 -0400, Uwe Salomon <post uwesalomon.de> wrote:Sometimes { } doesn't introduce a new scope, depending on the statement. In this case I don't think it does and so it should work how he is using it.version(DLL_C) // If we want a DLL interface for C { export: extern(C): }AFAIK, this will not work as you expect! version() is not the same as #ifdef and friends, where you "include" something. The scope of export: and extern: ends at the closing brace! Anything after version() will have the normal D linkage. Ciao uwe
Jun 07 2005
Uwe Salomon wrote:I tried it and it works (tested with DMD 0.124). Michaelversion(DLL_C) // If we want a DLL interface for C { export: extern(C): }AFAIK, this will not work as you expect! version() is not the same as #ifdef and friends, where you "include" something. The scope of export: and extern: ends at the closing brace! Anything after version() will have the normal D linkage. Ciao uwe
Jun 08 2005
Since 'export' is a protection attribute, you can end any 'export:' attribute-statement by introducing a new protection attribute, such as 'public'. In other words:It would be nice also if it could be written this way: version(DLL_D) {export} int aaa() But maybe hard to implement.Maybe the 'alias' statement could be given a new case for attribute symbols... so you could do something like: -- Chris Sauls
Jun 07 2005
Chris Sauls wrote:Since 'export' is a protection attribute, you can end any 'export:' attribute-statement by introducing a new protection attribute, such as 'public'. In other words:Thank you! Michael
Jun 09 2005