Sign up

XInitThreads - undefined identifier

Hi!

I'm new to D and Gtkd, and i'm having problems with parallelism. The program crashes immediately after executing with the message "Error: undefined identifier 'XInitThreads'".

This is the command i use to compile the code:

ldc -w -disable-linker-strip-dead main.d extra.d -LX11 `pkg-config --cflags --libs gtkd-3`

Re: XInitThreads - undefined identifier

On 09/10/2016 10:02 AM, Edgar wrote:

Hi!

I'm new to D and Gtkd, and i'm having problems with parallelism. The program crashes immediately after executing with the message "Error: undefined identifier 'XInitThreads'".

This is the command i use to compile the code:

ldc -w -disable-linker-strip-dead main.d extra.d -LX11 `pkg-config --cflags --libs gtkd-3`

with ldc and dmd -L is used to pass flags to the linker, and the correct
linker flag to link with X11 is -lX11.

So you should pass -L-lX11 to ldc instead of just -LX11 to link with the
X11 library.

Re: XInitThreads - undefined identifier

Thanks!

I was getting this error message without "XInitThreads":

[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
flfr: xcbio.c:274: pollforevent: Assertion `!xcbxlibthreadssequence_lost' failed.
Aborted (core dumped)

Now i'm compiling with the correct linker flag "-L-lX11". But i'm geting this new message:

ldc -w -disable-linker-strip-dead main.d extra.d -L-lX11 pkg-config --cflags --libs gtkd-3
main.d(11): Error: undefined identifier 'XInitThreads'
make: *** [makefile:21: comp] Error 1

And when i try to import X11 from the code:

Error: module X is in file 'X11/X.d' which cannot be read

This is what the main.d file contains:

import std.stdio, std.process, core.thread;
import extra;
import X11.X, X11.Xlib;

int main(string[] args) {

clear_screen();
XInitThreads();

Main.init(args);
Vista *pW;
Vista w = new Vista();
pW = &w;
pW.init_ui();
Main.run();
delete pW;

return 0;

}

What am i doing wrong?

Re: XInitThreads - undefined identifier

On 09/10/2016 05:45 PM, Edgar wrote:

Thanks!

I was getting this error message without "XInitThreads":

[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
flfr: xcbio.c:274: pollforevent: Assertion `!xcbxlibthreadssequence_lost' failed.
Aborted (core dumped)

Now i'm compiling with the correct linker flag "-L-lX11". But i'm geting this new message:

ldc -w -disable-linker-strip-dead main.d extra.d -L-lX11 pkg-config --cflags --libs gtkd-3
main.d(11): Error: undefined identifier 'XInitThreads'
make: *** [makefile:21: comp] Error 1

And when i try to import X11 from the code:

Error: module X is in file 'X11/X.d' which cannot be read

This is what the main.d file contains:

import std.stdio, std.process, core.thread;
import extra;
import X11.X, X11.Xlib;

int main(string[] args) {

clear_screen();
XInitThreads();

Main.init(args);
Vista *pW;
Vista w = new Vista();
pW = &w;
pW.init_ui();
Main.run();
delete pW;

return 0;

}

What am i doing wrong?

Which X11 headers/binding are you using?

Re: XInitThreads - undefined identifier

Which X11 headers/binding are you using?

i want to apologize, i wasn't using any. But recently i've used X11 from "DSource bindings project". This message appears when i compile the code with it:

ldc -w -disable-linker-strip-dead main.d extra.d X.d Xlib.d -L-lX11 pkg-config --cflags --libs gtkd-3

Xlib.d(20): Error: use alias instead of typedef
Xlib.d(21): Error: use alias instead of typedef
Xlib.d(146): Error: use alias instead of typedef
Xlib.d(388): Warning: instead of C-style syntax, use D-style syntax 'byte[32] autorepeats'<br>Xlib.d(465): Error: use alias instead of typedef<br>Xlib.d(488): Error: use alias instead of typedef<br>Xlib.d(489): Error: use alias instead of typedef<br>Xlib.d(507): Error: use alias instead of typedef<br>Xlib.d(508): Error: use alias instead of typedef<br>Xlib.d(525): Error: use alias instead of typedef<br>Xlib.d(548): Error: use alias instead of typedef<br>Xlib.d(549): Error: use alias instead of typedef<br>Xlib.d(566): Error: use alias instead of typedef<br>Xlib.d(567): Error: use alias instead of typedef<br>Xlib.d(577): Warning: instead of C-style syntax, use D-style syntax 'byte[32] keyvector'
Xlib.d(838): Warning: instead of C-style syntax, use D-style syntax 'byte[20] b'
Xlib.d(839): Warning: instead of C-style syntax, use D-style syntax 'short[10] s'
Xlib.d(840): Warning: instead of C-style syntax, use D-style syntax 'long[5] l'
Xlib.d(914): Warning: instead of C-style syntax, use D-style syntax 'long[24] pad'
Xlib.d(1011): Error: use alias instead of typedef
Xlib.d(1012): Error: use alias instead of typedef
Xlib.d(1013): Error: use alias instead of typedef
Xlib.d(1069): Error: use alias instead of typedef
Xlib.d(1070): Error: use alias instead of typedef
Xlib.d(1073): Error: use alias instead of typedef
Xlib.d(1079): Error: use alias instead of typedef
make: *** [makefile:21: comp] Error 1

Then i tried with "Deimos" and everything went well (with the same compile command as above), until I executed the program:

"core.exception.RangeError@modelo.d(124): Range violation"

This is the code with Deimos:

<code>
import std.stdio, std.process, core.thread;
import extra;
import deimos.X11.X, deimos.X11.Xlib;

int main(string[] args) {

clear_screen();
XInitThreads();

Main.init(args);
Vista *pW;
Vista w = new Vista();
pW = &w;
pW.init_ui();
Main.run();
delete pW;

return 0;

}

</code>

Re: XInitThreads - undefined identifier

Now I want to apologize for my stupidity. The last problem was a typo in my code. Now it works perfect with Deimos binding.
Thanks Mike :)