| 1 | diff --git a/source/gtd/GirFunction.d b/source/gtd/GirFunction.d
|
| 2 | index 9cb0400..d925b22 100644
|
| 3 | |
| 4 | |
| 5 | @@ -255,6 +255,19 @@ final class GirFunction
|
| 6 | return false;
|
| 7 | }
|
| 8 |
|
| 9 | + /**
|
| 10 | + * Is this function a static inline function.
|
| 11 | + */
|
| 12 | +
|
| 13 | + bool isStaticInline()
|
| 14 | + {
|
| 15 | + // Hardcoded list of known static inline functions
|
| 16 | + if (cType.among("g_main_context_pusher_new", "g_main_context_pusher_free"))
|
| 17 | + return true;
|
| 18 | +
|
| 19 | + return false;
|
| 20 | +}
|
| 21 | +
|
| 22 | string[] getCallbackDeclaration()
|
| 23 | {
|
| 24 | string[] buff;
|
| 25 | diff --git a/source/gtd/GirPackage.d b/source/gtd/GirPackage.d
|
| 26 | index b12c9d5..c54edcc 100644
|
| 27 | |
| 28 | |
| 29 | @@ -544,6 +544,24 @@ final class GirPackage
|
| 30 |
|
| 31 | buff ~= getLibraries();
|
| 32 |
|
| 33 | + // Generate implementations for static inline functions
|
| 34 | + if (name == "glib")
|
| 35 | + {
|
| 36 | + // Implementation for g_main_context_pusher_new
|
| 37 | + buff ~= "\n// Static inline function implementations\n";
|
| 38 | + buff ~= "GMainContextPusher* g_main_context_pusher_new(GMainContext* mainContext)\n";
|
| 39 | + buff ~= "{\n";
|
| 40 | + buff ~= "\tg_main_context_push_thread_default(mainContext);\n";
|
| 41 | + buff ~= "\treturn cast(GMainContextPusher*)mainContext;\n";
|
| 42 | + buff ~= "}\n\n";
|
| 43 | +
|
| 44 | + // Implementation for g_main_context_pusher_free
|
| 45 | + buff ~= "void g_main_context_pusher_free(GMainContextPusher* pusher)\n";
|
| 46 | + buff ~= "{\n";
|
| 47 | + buff ~= "\tg_main_context_pop_thread_default(cast(GMainContext*)pusher);\n";
|
| 48 | + buff ~= "}\n\n";
|
| 49 | + }
|
| 50 | +
|
| 51 | buff ~= "\n\n__gshared extern(C)\n"
|
| 52 | ~ "{\n";
|
| 53 |
|
| 54 | @@ -556,7 +574,7 @@ final class GirPackage
|
| 55 |
|
| 56 | foreach ( funct; strct.functions )
|
| 57 | {
|
| 58 | - if ( funct.type == GirFunctionType.Callback || funct.type == GirFunctionType.Signal || funct.name.empty )
|
| 59 | + if ( funct.type == GirFunctionType.Callback || funct.type == GirFunctionType.Signal || funct.name.empty || funct.isStaticInline() )
|
| 60 | continue;
|
| 61 |
|
| 62 | buff ~= "\t"~ funct.getExternal() ~"\n";
|