On Tue, 27 Dec 2016 23:38:01 +0100, Mike Wey wrote:

On 12/09/2016 05:23 AM, dlang user wrote:

On Sun, 2 Oct 2016 22:26:31 +0200, Mike Wey wrote:

On 09/25/2016 01:02 AM, dlang user wrote:

I am trying to get gsv.SourceCompletionWords working and this is the error that I get when I try to call SourceView.getCompletion():

(gtktest:4767): GtkSourceView-ERROR **: Error while loading the completion UI: .:23:106 Invalid object type 'GtkSourceCompletionInfo'

Does anyone have any suggestions?

Here is a test program to illustrate.
The error gets thrown on the "SourceCompletion sc = sv.getCompletion();" line:

import gio.Application : GioApplication = Application;
import gtk.Application;
import gtk.ApplicationWindow;
import gtk.Label;

import gsv.SourceView;
import gsv.SourceCompletion;

class HelloWorld : ApplicationWindow
{
	this(Application application)
	{
		super(application);
		setTitle("GtkD");
		setBorderWidth(10);
		add(new Label("Hello World"));

		SourceView sv = new SourceView();
		SourceCompletion sc = sv.getCompletion();


		
		showAll();
	}
}

int main(string[] args)
{
	auto application = new Application("org.gtkd.demo.helloworld", GApplicationFlags.FLAGS_NONE);
	application.addOnActivate(delegate void(GioApplication app) { new HelloWorld(application); });
	return application.run(args);
}

Sorry for the late reply, I tried looking into this but i haven't been
successful. And google only turns up one result for he error message
that doesn't include an answer. So for now i have no clue on how to
solve this.

I may have stumbled across a possible solution for this. After some additional googling, I found a recommendation to use the RTLD_GLOBAL flag in the dlopen function.

I tested it out by making the following change to the Loader.d file:

	private void* pLoadLibrary(string libraryName, RTLD flag = RTLD.NOW)
	{
		void* handle = dlopen(cast(char*)toStringz(libraryName), flag | RTLD.GLOBAL);

		// clear the error buffer
		dlerror();

		return handle;
	}

My test app now works, but I have no idea if this is the correct fix or not (I mainly have a c# background).

I finally took the time to test this out.
Fixed in:
https://github.com/gtkd-developers/GtkD/commit/da44a553ac5b8e698d7178d38c96a58c1b55dae3

Great. Thanks for getting it into the 3.4 release.