Created
January 27, 2018 21:05
-
-
Save RedHatter/a722b9dba6377e22f2c490ebdac5aa8c to your computer and use it in GitHub Desktop.
Gjs doesn't seem to execute Vala constructors. test.js should print 5 but instead it prints 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
valac gjs_constructor_test.vala -X -fPIC -X -shared -o gjs_constructor_test.so --library=GjsConstructorTest --gir GjsConstructorTest-0.1.gir | |
g-ir-compiler --shared-library=gjs_constructor_test.so --output=GjsConstructorTest-0.1.typelib GjsConstructorTest-0.1.gir | |
cp gjs_constructor_test.so /usr/lib/ | |
cp GjsConstructorTest-0.1.typelib /usr/lib/girepository-1.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace GjsConstructorTest { | |
public class TestClass : GLib.Object | |
{ | |
private int field; | |
public TestClass () { | |
this.field = 5; | |
} | |
public int getField () { | |
return this.field; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/gjs | |
const TestClass = imports.gi.GjsConstructorTest.TestClass | |
let test = new TestClass() | |
print(test.getField()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment