Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- import std.typecons;
- private immutable auto extensionTable = [
- ["WGL_ARB_make_current_read",
- "void function(int, int, int)", "wglMakeContextCurrentARB",
- "void function()", "wglGetCurrentReadDCARB"],
- ["WGL_ARB_pixel_format_float"],
- ["WGL_ARB_create_context",
- "void function(int, int, int)", "wglCreateContextAttribsARB"],
- ];
- private template genTypes()
- {
- string eval()
- {
- string code;
- foreach (array; extensionTable)
- {
- for (int index = 1; index < array.length; index += 2)
- {
- code ~= "alias nothrow " ~ array[index] ~ " da_" ~ array[index + 1] ~ ";";
- }
- }
- return code;
- }
- string genTypes = eval();
- //const(char[]) genTypes = eval(); // fix
- }
- mixin(genTypes!()); // Error: variable genTypes cannot be read at compile time
- void main()
- {
- assert(is(da_wglCreateContextAttribsARB));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement