Re: DLL loading behaviors and pragma(lib)

2017-08-10 Thread rikki cattermole via Digitalmars-d-learn

On 11/08/2017 12:18 AM, David Zhang wrote:
I've been working on getting OpenGL to load on windows without a 
library, and encountered something curious;


Context creation fails when I try to use the function pointer retrieved 
through GetProcAddress, but works just fine with the statically linked 
version provided through core.sys.windows.wingdi.d.


This may be a stupid question, but why is this?

Thanks.


Odd.

Just to confirm your wglGetProcAddress, is extern(Windows/System)?
And it is non-null after being loaded?


Re: Bug in D?!

2017-08-10 Thread ketmar via Digitalmars-d-learn

Mr. Pib wrote:


string Q(alias T, alias D)()
{
pragma(msg, T);
pragma(msg, D);
enum x = T~" = "~D~";";
pragma(msg, x);
}


mixin(Q!(`x`, 100)());

outputs, at compile time,

x
100
x = d;

there is no lowercase d. I did initially define Q as

string Q(alias T, D)(D d)

and one might think it is remnants left over from I cleaned the project 
so it shouldn't be happening. Seems like a bug.


(I realized that I'd probably only ever pass compile time values)

Of course, using D.stringof gives the value.

The problem is the case of D.


nope. the problem is the *value* of D. `char(100)` == 'd'.

string s = "<"~100~">";

yes, this works. weither this bug or not is questionable, but this is how D 
works regerding to implicit type conversions: small ints (in the range of 
[0..char.max]) will be implicitly converted to `char` if necessary.


Bug in D?!

2017-08-10 Thread Mr. Pib via Digitalmars-d-learn

string Q(alias T, alias D)()
{
pragma(msg, T);
pragma(msg, D);
enum x = T~" = "~D~";";
pragma(msg, x);
}


mixin(Q!(`x`, 100)());

outputs, at compile time,

x
100
x = d;

there is no lowercase d. I did initially define Q as

string Q(alias T, D)(D d)

and one might think it is remnants left over from I cleaned the 
project so it shouldn't be happening. Seems like a bug.


(I realized that I'd probably only ever pass compile time values)

Of course, using D.stringof gives the value.

The problem is the case of D.






Re: GTKD resources

2017-08-10 Thread Mr. Pib via Digitalmars-d-learn

On Friday, 11 August 2017 at 02:27:21 UTC, captaindet wrote:

On 2017-08-11 13:00, Mr. Pib wrote:
How can one include external files such as glade, icons, 
images that are
static in nature in to the binary but not require extraction 
on program

run to be used?

gtk's builder doesn't seem to take an in memory representation 
of glade
files and building a pixbuf seems quite over the top to do 
such simple

things?



including the glade UI/XML defs to the executable is simple, 
compile with -J. switch and:



immutable string UIdefs = import("myuidefs.glade");
...
main(){
...
builder.addFromString( UIdefs );
...


Thanks. It one can use pixbuf to do something similar, albeit 
more complicated.


https://stackoverflow.com/questions/14121166/gdk-pixbuf-load-image-from-memory





Re: GTKD resources

2017-08-10 Thread captaindet via Digitalmars-d-learn

On 2017-08-11 13:00, Mr. Pib wrote:

How can one include external files such as glade, icons, images that are
static in nature in to the binary but not require extraction on program
run to be used?

gtk's builder doesn't seem to take an in memory representation of glade
files and building a pixbuf seems quite over the top to do such simple
things?



including the glade UI/XML defs to the executable is simple, compile 
with -J. switch and:



immutable string UIdefs = import("myuidefs.glade");
...
main(){
...
builder.addFromString( UIdefs );
...


Re: DlangUI Error

2017-08-10 Thread Mike Parker via Digitalmars-d-learn

On Thursday, 10 August 2017 at 23:38:42 UTC, Jiyan wrote:



So the strange thing is i had an older compiler (v2.074.1), so
i started running the 2.075 version - with which it worked!
The thing is i can start the 2.075 version only over the 
activate.sh
script in a shell. Can you tell me how i can really use the 
2.075 version
(without having to run the script each time i open a shell, and 
why do

i have to do that).


Sounds like you used the script from the download page that 
installs the compiler per user. It's designed to allow you to 
have multiple versions installed in your user directory and 
requires you to specify which version you want to activate. You 
could probably configure your bash shell to activate dmd when you 
launch it, or you could install dmd via the .deb or .rpm, 
assuming you're on a Linux flavor.


GTKD resources

2017-08-10 Thread Mr. Pib via Digitalmars-d-learn
How can one include external files such as glade, icons, images 
that are static in nature in to the binary but not require 
extraction on program run to be used?


gtk's builder doesn't seem to take an in memory representation of 
glade files and building a pixbuf seems quite over the top to do 
such simple things?





Re: DlangUI Error

2017-08-10 Thread HyperParrow via Digitalmars-d-learn

On Thursday, 10 August 2017 at 23:38:42 UTC, Jiyan wrote:

On Thursday, 10 August 2017 at 22:27:44 UTC, HyperParrow wrote:

On Thursday, 10 August 2017 at 20:48:23 UTC, Jiyan wrote:

Hey,
i get the following errors when i try to use dlangui, by just 
importing the package i get a lot of errors which look like:
function std.xml.Item.opEquals does not override any 
function, did you mean to override 'object.Object.opEquals'?


What is happening there?


The error message is correct but the error is only recognized 
by the compiler since the latest release. To fix it requires 
intervention of the author: either "override" must be removed 
from the opEquals that's indicated or the opEquals parameters 
must be changed o match exactly the signature used on 
Object.opEquals.


Until this is done in libdlangui you can use an older 
compiler, e.g last 2.074.x release should make the error 
disappearing (since it wasn't detected yet).


Hey thank you for your reply :)

So the strange thing is i had an older compiler (v2.074.1), so
i started running the 2.075 version - with which it worked!


Small confusion from my part.

The thing is i can start the 2.075 version only over the 
activate.sh
script in a shell. Can you tell me how i can really use the 
2.075 version
(without having to run the script each time i open a shell, and 
why do

i have to do that).


I have no idea of what is this script. Actually i don't use 
dlangui at all.

I stop here.


Re: DlangUI Error

2017-08-10 Thread Jiyan via Digitalmars-d-learn

On Thursday, 10 August 2017 at 22:27:44 UTC, HyperParrow wrote:

On Thursday, 10 August 2017 at 20:48:23 UTC, Jiyan wrote:

Hey,
i get the following errors when i try to use dlangui, by just 
importing the package i get a lot of errors which look like:
function std.xml.Item.opEquals does not override any function, 
did you mean to override 'object.Object.opEquals'?


What is happening there?


The error message is correct but the error is only recognized 
by the compiler since the latest release. To fix it requires 
intervention of the author: either "override" must be removed 
from the opEquals that's indicated or the opEquals parameters 
must be changed o match exactly the signature used on 
Object.opEquals.


Until this is done in libdlangui you can use an older compiler, 
e.g last 2.074.x release should make the error disappearing 
(since it wasn't detected yet).


Hey thank you for your reply :)

So the strange thing is i had an older compiler (v2.074.1), so
i started running the 2.075 version - with which it worked!
The thing is i can start the 2.075 version only over the 
activate.sh
script in a shell. Can you tell me how i can really use the 2.075 
version
(without having to run the script each time i open a shell, and 
why do

i have to do that).


DLL loading behaviors and pragma(lib)

2017-08-10 Thread David Zhang via Digitalmars-d-learn
I've been working on getting OpenGL to load on windows without a 
library, and encountered something curious;


Context creation fails when I try to use the function pointer 
retrieved through GetProcAddress, but works just fine with the 
statically linked version provided through 
core.sys.windows.wingdi.d.


This may be a stupid question, but why is this?

Thanks.


Re: string hash significant speedup

2017-08-10 Thread HyperParrow via Digitalmars-d-learn
On Thursday, 10 August 2017 at 20:07:35 UTC, Steven Schveighoffer 
wrote:

On 8/10/17 3:36 PM, Johnson Jones wrote:
when using T[string], hashing is used. Computing the hash is 
slow(relatively speaking).


Does D cache the hashes? Strings are immutable so there is 
absolutely no reason why the hash ever need to be computed 
more than once.


It computes them on insertion, and caches the result in the 
structure of the hash table.


-Steve


But i think he speaks about the strings that are tested for 
inclusion (i.e opIn RHS), not those who are inserted, for which 
obviously the hash is known.


Re: DlangUI Error

2017-08-10 Thread HyperParrow via Digitalmars-d-learn

On Thursday, 10 August 2017 at 20:48:23 UTC, Jiyan wrote:

Hey,
i get the following errors when i try to use dlangui, by just 
importing the package i get a lot of errors which look like:
function std.xml.Item.opEquals does not override any function, 
did you mean to override 'object.Object.opEquals'?


What is happening there?


The error message is correct but the error is only recognized by 
the compiler since the latest release. To fix it requires 
intervention of the author: either "override" must be removed 
from the opEquals that's indicated or the opEquals parameters 
must be changed o match exactly the signature used on 
Object.opEquals.


Until this is done in libdlangui you can use an older compiler, 
e.g last 2.074.x release should make the error disappearing 
(since it wasn't detected yet).




Re: How do I compile a program with curl lib on Windows?

2017-08-10 Thread Neto via Digitalmars-d-learn

UPDATE 2:

Managed to do it! Got the precompiled binaries from here:


https://github.com/HazeProductions/libcurl


(thank @frk1 very much for his repo)

downloaded them then extracted the release folder to proper curl 
folder on my machine then



dmd -L-libcurl app.d -I"C:\libcrl"


worked just fine. Topic closed.


Re: string hash significant speedup

2017-08-10 Thread Johnson Jones via Digitalmars-d-learn
On Thursday, 10 August 2017 at 20:07:35 UTC, Steven Schveighoffer 
wrote:

On 8/10/17 3:36 PM, Johnson Jones wrote:
when using T[string], hashing is used. Computing the hash is 
slow(relatively speaking).


Does D cache the hashes? Strings are immutable so there is 
absolutely no reason why the hash ever need to be computed 
more than once.


It computes them on insertion, and caches the result in the 
structure of the hash table.


-S


Thanks. What is the cache size?




Re: How do I compile a program with curl lib on Windows?

2017-08-10 Thread Neto via Digitalmars-d-learn

On Thursday, 10 August 2017 at 20:29:53 UTC, Neto wrote:
Could someone give me an example to how do I compile a program 
with support to curl on Windows? Where do I find the .lib for 
link against my D programa under Windows or do I need to 
compile it myself? I downloaded the lib versions at curl's 
official web site but I find either .a files or .h in the lib 
folder


UPDATE:

Found the links right here:


https://github.com/HazeProductions/libcurl


Compiling as:

dmd  -dw -m32 -L-lcurl app.d 
-I"C:\Users\neto\Desktop\static-debug-x86"


I get the following error:


OPTLINK: Warning 9: Unknow option: LCURL


What am I missing? is the library name wrong/couldn't be found or 
what else?


DlangUI Error

2017-08-10 Thread Jiyan via Digitalmars-d-learn

Hey,
i get the following errors when i try to use dlangui, by just 
importing the package i get a lot of errors which look like:
function std.xml.Item.opEquals does not override any function, 
did you mean to override 'object.Object.opEquals'?


What is happening there?


How do I compile a program with curl lib on Windows?

2017-08-10 Thread Neto via Digitalmars-d-learn
Could someone give me an example to how do I compile a program 
with support to curl on Windows? Where do I find the .lib for 
link against my D programa under Windows or do I need to compile 
it myself? I downloaded the lib versions at curl's official web 
site but I find either .a files or .h in the lib folder


Re: string hash significant speedup

2017-08-10 Thread Steven Schveighoffer via Digitalmars-d-learn

On 8/10/17 3:36 PM, Johnson Jones wrote:
when using T[string], hashing is used. Computing the hash is 
slow(relatively speaking).


Does D cache the hashes? Strings are immutable so there is absolutely no 
reason why the hash ever need to be computed more than once.


It computes them on insertion, and caches the result in the structure of 
the hash table.


-Steve


string hash significant speedup

2017-08-10 Thread Johnson Jones via Digitalmars-d-learn
when using T[string], hashing is used. Computing the hash is 
slow(relatively speaking).


Does D cache the hashes? Strings are immutable so there is 
absolutely no reason why the hash ever need to be computed more 
than once.


Essentially the hash should be attached to strings like their 
length and address.


Does D compute the hash of a string every time it is looked up? 
If so, any way to optimize that it?


Vectorflow noob

2017-08-10 Thread Jiyan via Digitalmars-d-learn

Hey,
wanted to the following simple thing with vectorflow:

I want to develop a simple MLP, which has 2 input neurons and one 
output neuron.
The network should simply add the input values together, so [1,2] 
predicts [3] i guess.

I started in a newbish way to build the following code:

import vectorflow;


struct Obs // The represeneted data
{
	float label; // Did i get that right that label would be the 
DESIRED output (3=1+2)
	float []features; // The features are the input i guess, so 
features = f.e. [1,2]

}

void main()
{

auto net = NeuralNet()
.stack(DenseData(2))
	.stack(Linear(10));   // Is this the right way to construct 
the Net?


// The training data
Obs []data;


data.length = 10;

import std.random;
import std.algorithm;
foreach(ref Obs n; data)
{
		// The features are getting fille with random numbers between 
0.5 and 5

// The label becomes the sum of feature[0] and feature[1]
n.features.length = 2;
n.features[0] = uniform(0.5, 5);
n.features[1] = uniform(0.5, 5);

n.label = n.features.sum;
writeln(n.features[0], " ", n.features[1], " ", n.label);
assert (n.label == n.features[0] + n.features[1]);
}

net.learn(data, "logistic", AdaGrad(10, 0.1, 500), true, 3);

auto val = net.predict(data[0]); // is this wrong?
val.writeln;
}

Thanks :)


Re: Why does stringof not like functions with arguments?

2017-08-10 Thread Meta via Digitalmars-d-learn

On Thursday, 10 August 2017 at 15:55:41 UTC, Jason Brady wrote:
Wow. That makes perfect sense. I forgot stringof works only 
with expressions


It works with symbols too. See the following:

template test(){}
pragma(msg, test.stringof);




Re: Why does stringof not like functions with arguments?

2017-08-10 Thread Jason Brady via Digitalmars-d-learn

On Thursday, 10 August 2017 at 14:51:22 UTC, Meta wrote:


Welcome to optional parentheses hell. Please enjoy your stay.

Because function calls in D can optionally omit the parens, 
`FunctionWithArguments.stringof` is actually attempting to call 
`FunctionWithArguments` without any arguments, and then call 
`stringof` on the result. In other words, it's actually trying 
to do this:


writeln(FunctionWithArguments().stringof);

And the D compiler is rightly telling you that you can't call 
the function with no arguments. The easiest solution is to use 
__traits(identifier) instead:


writeln(__traits(identifier, FunctionWithArguments));

You can make a handy template helper to do this for you:

enum stringOf(alias symbol) = __traits(identifier, symbol);
writeln(stringOf!FunctionWithArguments);


Wow. That makes perfect sense. I forgot stringof works only with 
expressions and that a function name is a valid expression in the 
case of UCF.


I already found the __traits as a workaround, but the template 
helper is a great idea. Thanks!


Re: delegates/lambas do not pick up calling convention

2017-08-10 Thread Timon Gehr via Digitalmars-d-learn

On 10.08.2017 15:22, Adam D. Ruppe wrote:

On Wednesday, 9 August 2017 at 23:52:00 UTC, Johnson Jones wrote:

extern(C) delegate(void*) {}


You should very rarely use extern(C) delegate... delegate is a D type, 
so the C function is almost certainly not actually receiving it.


Only time you'd want an extern(C) using D types like delegates, arrays, 
strings, etc., is if the receiver is actually also written in D.


idk if this would fix your problem, but it should be changed regardless.


gdk is actually using a function with arguments of type (extern(C) int 
function(void*),void*).


Anyway, I think there are use cases for extern(C) delegates too, along 
the following lines:


alias D=extern(C) int delegate(int);

struct F(S,T...){ // this struct is compatible with C
void* ptr;
extern(C) S function(void*,T) funptr;
auto opCall(T args){
return funptr(ptr,args);
}
}

void main(){
int y=2;
D dg=(x)=>x+y;
auto f=*cast(F!(int,int)*)
import std.stdio;
writeln(f(3));
}


Re: Fix gtkD api display

2017-08-10 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 10 August 2017 at 14:55:06 UTC, Mike Wey wrote:
The problem was that there are a few large classes at the start 
of the hierarchy, and with the old version of ddox the function 
pages would not only be generated for the base class, but also 
for all the derived classes.


Oh, I see. My generator lists them on the index, but doesn't 
recreate it each time, it just links. For example:


http://dpldocs.info/experimental-docs/gtk.ApplicationWindow.ApplicationWindow.html

it lists inherited members again, but not all their docs.


That would be great.


kewl

I don't use the documentation myself so this isn't really a 
problem.


It is a lot easier to link to individual pages from the outside 
which means search is more reliable, the back button works, stuff 
like that.


Re: Fix gtkD api display

2017-08-10 Thread Mike Wey via Digitalmars-d-learn

On 10-08-17 15:57, Adam D. Ruppe wrote:

On Saturday, 5 August 2017 at 14:02:09 UTC, Mike Wey wrote:
One issue is the shear size of the generated documentation, though the 
current version of ddox no longer generates a ton of unused files 
bringing the size down from 15-20GB to a mere 2GB.


what?! I'm not actually sure how much gtk alone takes, but my entire doc 
folder is 4 GB, including a good chunk of the dub repo, phobos, 
druntime, my stuff, search indexes, archives, etc.


I guess it is possible the gtkd is 2 GB of that, but at least it isn't 20.


The problem was that there are a few large classes at the start of the 
hierarchy, and with the old version of ddox the function pages would not 
only be generated for the base class, but also for all the derived classes.


So when you have a base class with 264 functions, and you have 385 
classes that are directly or indirectly derived from it.
Things start to add up, That is 101_640 html pages just for this one 
case, and there are more.


Luckily this is fixed, especially because ddox never actually linked to 
these pages.


The need to go trough the empty module page when browsing the 
documentation. For a lot / most? functions the complete documentation 
is in the overview defeating the purpose of the one page per artifact.


If you guys are interested, I can do a custom adrdox for gtk that:

* reads more of the gtk syntax 
https://developer.gnome.org/gtk-doc-manual/stable/documenting_syntax.html.en 



* recognizes the one-item-per-module pattern and skips the empty pages

* has a style more like https://gtkd.org/index.html

* Maybe a few other little things?


That would be great.


And im not a big fan of the one page per artifact style of documentation.


Oh, it is so much better in a lot of ways.


I don't use the documentation myself so this isn't really a problem.

--
Mike Wey


Re: Why does stringof not like functions with arguments?

2017-08-10 Thread Meta via Digitalmars-d-learn

On Wednesday, 9 August 2017 at 01:39:07 UTC, Jason Brady wrote:

Why does the following code error out with:

app.d(12,10): Error: function app.FunctionWithArguments (uint 
i) is not callable using argument types ()


Code:

import std.stdio;

void FunctionWithoutArguments() {
}

void FunctionWithArguments(uint i) {
}

void main()
{
writeln(FunctionWithoutArguments.stringof);
writeln(FunctionWithArguments.stringof);
}


Welcome to optional parentheses hell. Please enjoy your stay.

Because function calls in D can optionally omit the parens, 
`FunctionWithArguments.stringof` is actually attempting to call 
`FunctionWithArguments` without any arguments, and then call 
`stringof` on the result. In other words, it's actually trying to 
do this:


writeln(FunctionWithArguments().stringof);

And the D compiler is rightly telling you that you can't call the 
function with no arguments. The easiest solution is to use 
__traits(identifier) instead:


writeln(__traits(identifier, FunctionWithArguments));

You can make a handy template helper to do this for you:

enum stringOf(alias symbol) = __traits(identifier, symbol);
writeln(stringOf!FunctionWithArguments);


Re: gtkD window centering message up and no app on taskbar

2017-08-10 Thread Mike Wey via Digitalmars-d-learn

On 09-08-17 23:54, Johnson Jones wrote:

Ok, I added

 import core.sys.windows.winuser;
 __gshared extern(C) core.sys.windows.winuser.HANDLE 
function(GdkWindow*) gdk_win32_window_get_handle;
 Linker.link(gdk_win32_window_get_handle, 
"gdk_win32_window_get_handle", LIBRARY_GDK);


to GtkD\generated\gtkd\gdk\c\functions.d

and rebuilt and it seems to work. Hopefully that is the right place so 
in the future when I replace GtkD with it won't show up as a bug in my 
code somewhere. I assume master will be updated with this at some point?


That would be the correct place. If it is added to GtkD it won't be in 
functions.d, which is generated. It would be something like: gdk.c.win32.


--
Mike Wey


Re: Fix gtkD api display

2017-08-10 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 5 August 2017 at 14:02:09 UTC, Mike Wey wrote:
One issue is the shear size of the generated documentation, 
though the current version of ddox no longer generates a ton of 
unused files bringing the size down from 15-20GB to a mere 2GB.


what?! I'm not actually sure how much gtk alone takes, but my 
entire doc folder is 4 GB, including a good chunk of the dub 
repo, phobos, druntime, my stuff, search indexes, archives, etc.


I guess it is possible the gtkd is 2 GB of that, but at least it 
isn't 20.



The need to go trough the empty module page when browsing the 
documentation. For a lot / most? functions the complete 
documentation is in the overview defeating the purpose of the 
one page per artifact.


If you guys are interested, I can do a custom adrdox for gtk that:

* reads more of the gtk syntax 
https://developer.gnome.org/gtk-doc-manual/stable/documenting_syntax.html.en


* recognizes the one-item-per-module pattern and skips the empty 
pages


* has a style more like https://gtkd.org/index.html

* Maybe a few other little things?

And im not a big fan of the one page per artifact style of 
documentation.


Oh, it is so much better in a lot of ways.


Re: delegates/lambas do not pick up calling convention

2017-08-10 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 9 August 2017 at 23:52:00 UTC, Johnson Jones wrote:

extern(C) delegate(void*) {}


You should very rarely use extern(C) delegate... delegate is a D 
type, so the C function is almost certainly not actually 
receiving it.


Only time you'd want an extern(C) using D types like delegates, 
arrays, strings, etc., is if the receiver is actually also 
written in D.


idk if this would fix your problem, but it should be changed 
regardless.


Re: Efficiently streaming data to associative array

2017-08-10 Thread Jon Degenhardt via Digitalmars-d-learn
On Wednesday, 9 August 2017 at 13:36:46 UTC, Steven Schveighoffer 
wrote:

On 8/8/17 3:43 PM, Anonymouse wrote:
On Tuesday, 8 August 2017 at 16:00:17 UTC, Steven 
Schveighoffer wrote:
I wouldn't use formattedRead, as I think this is going to 
allocate temporaries for a and b.


What would you suggest to use in its stead? My use-case is 
similar to the OP's in that I have a string of tokens that I 
want split into variables.


using splitter(","), and then parsing each field using 
appropriate function (e.g. to!)


For example, the OP's code, I would do:

auto r = line.splitter(",");
a = r.front;
r.popFront;
b = r.front;
r.popFront;
c = r.front.to!int;

It would be nice if formattedRead didn't use appender, and 
instead sliced, but I'm not sure it can be fixed.


Note, one could make a template that does this automatically in 
one line.


-Steve


The blog post Steve referred to has examples of this type 
processing while iterating over lines in a file. A couple 
different ways to access the elements are shown. AA access is 
addressed also: 
https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/


--Jon


Re: delegates/lambas do not pick up calling convention

2017-08-10 Thread Timon Gehr via Digitalmars-d-learn

On 10.08.2017 01:52, Johnson Jones wrote:

given somethign like Threads.threadsAddIdle

which takes an extern(C) int (void*)

we can't seem to do

threadsAddIdle((void*) { }, null);


I think this is a compiler bug. Try:

threadsAddIdle((x){ }, null);

It seems that the calling convention is deduced only if the parameter 
type needs to be deduced too.


https://issues.dlang.org/show_bug.cgi?id=17739


Re: delegates/lambas do not pick up calling convention

2017-08-10 Thread ag0aep6g via Digitalmars-d-learn

On 08/10/2017 01:52 AM, Johnson Jones wrote:

I've tried

 import gdk.Threads;
 alias DD = static 
extern(C) int delegate(void*);

 auto x = (void*)
 {
 return 1;
 };
 
gdk.Threads.threadsAddIdle(x, null);


1) You probably meant to apply `DD` to `x`.
2) `x` must be a `function`, not a `delegate`.
3) (optional) `static` is not needed.

So:


import gdk.Threads;
alias DD = extern(C) int function(void*);
DD x = (void*)
{
return 1;
};
gdk.Threads.threadsAddIdle(x, null);



Re: D on AArch64 CPU

2017-08-10 Thread David J Kordsmeier via Digitalmars-d-learn

On Wednesday, 9 August 2017 at 08:37:53 UTC, Johannes Pfau wrote:


Iain recently updated GDC & phobos up to 2.074 and we have a 
pull request for 2.075. So don't worry about fixing old GDC 
phobos/druntime versions, recent gdc git branches should 
already have AArch64 phobos changes.


We have a test runner for AArch and GDC master here: 
https://buildbot.dgnu.org/#/builders/2/builds/29


There are still some failing test suite tests though and AFAICS 
we currently don't build phobos on that CI at all.


(We can run ARM/AArch tests without special hardware, thanks to
QEMU's user mode emulation)

-- Johannes


Thanks both for the reply.   I'll be interested to try both gdc 
and the ldc cross compiler options.