| Thread overview | ||||||||
|---|---|---|---|---|---|---|---|---|
|
May 09, 2004 Attributes problems (any ideas for a fix... maybe []?) | ||||
|---|---|---|---|---|
| ||||
Attributes are pretty good, but they need another form
I need to be able to do
version(UseWindowExports) {
[extern (Windows):]
}else {
[extern (C):]
}
void glStipple (int, short);
right now the colon ends at the next closing brace
I want it to survive ONE extra closing brace... or until the next attribute.
if I take out the closing brace, then I have to write the glStipple (n) times
where n is the number of versions of the lib I want to make
can anyone help think of some syntax to fix this..it really makes writing cross-platform headers quite unfeasable the way it is.
the language needs ways to make cross-platform headers with different linkages specified on a per-version basis... I can't have gl_sgi.h gl_mac.h gl_windows.h gl_linux.h gl_ppclinux.h(different ABI)
--Daniel
| ||||
May 09, 2004 Re: Attributes problems (any ideas for a fix... maybe []?) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to hellcatv | <hellcatv@hotmail.com> wrote in message news:c7k0kq$2vvs$1@digitaldaemon.com | Attributes are pretty good, but they need another form | I need to be able to do | | version(UseWindowExports) { | [extern (Windows):] | }else { | [extern (C):] | } | void glStipple (int, short); | | right now the colon ends at the next closing brace | I want it to survive ONE extra closing brace... or until the next attribute. | if I take out the closing brace, then I have to write the glStipple (n) times | where n is the number of versions of the lib I want to make | | can anyone help think of some syntax to fix this..it really makes writing | cross-platform headers quite unfeasable the way it is. | | the language needs ways to make cross-platform headers with different linkages | specified on a per-version basis... I can't have gl_sgi.h gl_mac.h gl_windows.h | gl_linux.h gl_ppclinux.h(different ABI) | | --Daniel You can omit the braces: version(Windows) extern(Windows): else extern(C): ----------------------- Carlos Santander Bernal | |||
May 09, 2004 Re: Attributes problems (any ideas for a fix... maybe []?) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to hellcatv | <hellcatv@hotmail.com> wrote in message news:c7k0kq$2vvs$1@digitaldaemon.com... > Attributes are pretty good, but they need another form > I need to be able to do > > version(UseWindowExports) { > [extern (Windows):] > }else { > [extern (C):] > } > void glStipple (int, short); > > right now the colon ends at the next closing brace > I want it to survive ONE extra closing brace... or until the next attribute. > if I take out the closing brace, then I have to write the glStipple (n) times > where n is the number of versions of the lib I want to make > > can anyone help think of some syntax to fix this..it really makes writing cross-platform headers quite unfeasable the way it is. > > the language needs ways to make cross-platform headers with different linkages > specified on a per-version basis... I can't have gl_sgi.h gl_mac.h gl_windows.h > gl_linux.h gl_ppclinux.h(different ABI) > > --Daniel I think something like this would fit in better: version(Something) alias extern(Windows) foo; else alias extern(C) foo; extern(foo): void stuff(); | |||
May 09, 2004 Re: Attributes problems (any ideas for a fix... maybe []?) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | In article <c7k51f$43n$1@digitaldaemon.com>, Carlos Santander B. says... > ><hellcatv@hotmail.com> wrote in message news:c7k0kq$2vvs$1@digitaldaemon.com >| Attributes are pretty good, but they need another form >| I need to be able to do >| >| version(UseWindowExports) { >| [extern (Windows):] >| }else { >| [extern (C):] >| } >| void glStipple (int, short); >| >| right now the colon ends at the next closing brace >| I want it to survive ONE extra closing brace... or until the next >attribute. >| if I take out the closing brace, then I have to write the glStipple (n) >times >| where n is the number of versions of the lib I want to make >| >| can anyone help think of some syntax to fix this..it really makes writing >| cross-platform headers quite unfeasable the way it is. >| >| the language needs ways to make cross-platform headers with different >linkages >| specified on a per-version basis... I can't have gl_sgi.h gl_mac.h >gl_windows.h >| gl_linux.h gl_ppclinux.h(different ABI) >| >| --Daniel > >You can omit the braces: >version(Windows) > extern(Windows): >else > extern(C): does that invalidate the next statement for windows? what if I had export void glEnd(); would that go undefined in the windows version? or does the version command stop on the colon. can I have some dummy statement next? | |||
May 09, 2004 Re: Attributes problems (any ideas for a fix... maybe []?) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to hellcatv | <hellcatv@hotmail.com> wrote in message news:c7l24k$1fj7$1@digitaldaemon.com | In article <c7k51f$43n$1@digitaldaemon.com>, Carlos Santander B. says... || || You can omit the braces: || version(Windows) || extern(Windows): || else || extern(C): | does that invalidate the next statement for windows? | what if I had | export void glEnd(); | | would that go undefined in the windows version? or does the version command stop | on the colon. | can I have some dummy statement next? I don't think it'll go undefined. However you can try and see what happens. ----------------------- Carlos Santander Bernal | |||
May 11, 2004 Re: Attributes problems (any ideas for a fix... maybe []?) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Vathix | My first thought is to say this looks like a good idea. But my second thought says that alias is starting to look more and more like a macro language...
Vathix wrote:
> I think something like this would fit in better:
>
> version(Something)
> alias extern(Windows) foo;
> else
> alias extern(C) foo;
> extern(foo):
> void stuff();
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply