On 08/02/2016 07:55 PM, Mark J Twain wrote:
It's nice to be able to pass delegates and functions as callbacks.
A nice feature is something like
R foo(R,Args...)(R function(Args) callback, Args args) { return
callback(args); }
There are two problems with this.
One is that type deduction
On 2016-08-03 10:27, RomanZ wrote:
version(RefOut)
extern(C) void fun(out int input, ref in output);
else
extern(C) void fun( /*[out]*/ int* input, const(float)* output);
version = RefOut;
void main() {
int input;
float output;
fun( input, output ); // work fine; is it
version(RefOut)
extern(C) void fun(out int input, ref in output);
else
extern(C) void fun( /*[out]*/ int* input, const(float)* output);
version = RefOut;
void main() {
int input;
float output;
fun( input, output ); // work fine; is it correct binding? or
On Monday, 1 August 2016 at 16:09:50 UTC, Alex wrote:
On Monday, 1 August 2016 at 15:51:58 UTC, Jonathan M Davis
wrote:
template isIndexable(I, T)
{
enum isIndexable = __traits(compiles, T.init[I.init]);
}
As a last question afterwards:
Is it possible to create such an isIndexable
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote:
So basically I have to create wrapper.c ?
Yes, but you should write it in D. Runtime initialization is at
https://dlang.org/phobos/core_runtime.html#.Runtime
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote:
On Wednesday, 3 August 2016 at 14:58:04 UTC, bachmeier wrote:
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote:
by switching my file to just this
extern(C)
{
char* foo(char* str)
{
return str;
}
}
It works.
On Wednesday, 3 August 2016 at 15:56:34 UTC, llaine wrote:
Okay on stack overflow, they are not using ffi but dl.
I tried changing ffi to dl, it's the same don't work
unfortunatly.
That's about as far as I can go without having it set up on my
machine. The procedure should be the same as I
On Wednesday, 3 August 2016 at 15:24:56 UTC, llaine wrote:
On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote:
After digging a bit more, I get a different error.
import std.stdio;
import core.runtime;
extern(C)
{
void initialize()
{
Runtime.initialize();
}
void
thanks.
On Wednesday, 3 August 2016 at 15:24:56 UTC, llaine wrote:
On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote:
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote:
So basically I have to create wrapper.c ?
Yes, but you should write it in D. Runtime initialization is
at
On Wednesday, 3 August 2016 at 15:47:48 UTC, bachmeier wrote:
On Wednesday, 3 August 2016 at 15:24:56 UTC, llaine wrote:
On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote:
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote:
So basically I have to create wrapper.c ?
Yes, but
On Wednesday, 3 August 2016 at 14:02:12 UTC, Adam D. Ruppe wrote:
On Wednesday, 3 August 2016 at 13:44:46 UTC, llaine wrote:
void puts(string str)
{
writeln(str);
}
A D string isn't the same as a C string, so your params won't
work as-is, and writeln requires the D runtime to be
There's also official armv7hf release
https://github.com/ldc-developers/ldc/releases
On Wednesday, 3 August 2016 at 14:23:59 UTC, Jonathan M Davis
wrote:
On Wednesday, August 03, 2016 09:21:13 Alex via
Digitalmars-d-learn wrote:
On Monday, 1 August 2016 at 16:09:50 UTC, Alex wrote:
> On Monday, 1 August 2016 at 15:51:58 UTC, Jonathan M Davis
> wrote:
> template isIndexable(I,
On Wednesday, 3 August 2016 at 14:01:34 UTC, llaine wrote:
On Wednesday, 3 August 2016 at 13:49:36 UTC, bachmeier wrote:
Probably because you need the D runtime. One way is to import
core.runtime and call Runtime.initialize().
Where should I call this Runtime.initialize() ?
Does the
On Wednesday, 3 August 2016 at 15:14:24 UTC, Kagamin wrote:
On Wednesday, 3 August 2016 at 15:08:51 UTC, llaine wrote:
So basically I have to create wrapper.c ?
Yes, but you should write it in D. Runtime initialization is at
https://dlang.org/phobos/core_runtime.html#.Runtime
Okay I tried
On Wednesday, August 03, 2016 09:21:13 Alex via Digitalmars-d-learn wrote:
> On Monday, 1 August 2016 at 16:09:50 UTC, Alex wrote:
> > On Monday, 1 August 2016 at 15:51:58 UTC, Jonathan M Davis
> > wrote:
> > template isIndexable(I, T)
> > {
> >
> > enum isIndexable = __traits(compiles,
On Wednesday, 3 August 2016 at 14:58:04 UTC, bachmeier wrote:
On Wednesday, 3 August 2016 at 14:01:34 UTC, llaine wrote:
On Wednesday, 3 August 2016 at 13:49:36 UTC, bachmeier wrote:
Probably because you need the D runtime. One way is to import
core.runtime and call Runtime.initialize().
On 08/03/2016 10:58 AM, Andre Pany wrote:
> I try to initialize an array of objects. The methods (linear/equals/)
> returns object of different classes, but all implement a common
> interface "Element".
>
> Element[] elements =
>
On Wednesday, 3 August 2016 at 14:46:25 UTC, Alex wrote:
On Wednesday, 3 August 2016 at 14:23:59 UTC, Jonathan M Davis
wrote:
But it should.
Just found this:
https://www.sgi.com/tech/stl/StrictWeakOrdering.html
which should be fulfilled by a type, which can be used as a
key. So, in my
On Wednesday, August 03, 2016 16:42:18 Alex via Digitalmars-d-learn wrote:
> On Wednesday, 3 August 2016 at 14:46:25 UTC, Alex wrote:
> > On Wednesday, 3 August 2016 at 14:23:59 UTC, Jonathan M Davis
> > wrote:
> >
> > But it should.
> >
> > Just found this:
> >
On Wednesday, 3 August 2016 at 15:56:34 UTC, llaine wrote:
Okay on stack overflow, they are not using ffi but dl.
I tried changing ffi to dl, it's the same don't work
unfortunatly.
This FFI example calls an init function from a library:
Hi,
I just stumbled over this behavior. I am not sure whether
the behavior is correct or not.
alias foo = () => new Object;
void bar(Object o){}
void main()
{
auto n1 = foo;
bar(foo);
}
While first line in main is working fine,
second line does not compile due to missing ().
Hi,
I try to initialize an array of objects. The methods
(linear/equals/)
returns object of different classes, but all implement a common
interface "Element".
Element[] elements =
quadraticCoefficient(1)~linearCoefficient(2)~equals()~constant(1);
I tried different casts and different
On Wednesday, 3 August 2016 at 17:16:10 UTC, Andre Pany wrote:
Hi,
I just stumbled over this behavior. I am not sure whether
the behavior is correct or not.
[...]
alias foo = () => new Object;
...is an alias for a delegate/function returning an Object. It is
analogous to
alias foo = () {
On Wednesday, 3 August 2016 at 18:34:02 UTC, Ali Çehreli wrote:
On 08/03/2016 10:58 AM, Andre Pany wrote:
> [...]
(linear/equals/)
> [...]
common
> [...]
quadraticCoefficient(1)~linearCoefficient(2)~equals()~constant(1);
[...]
Thanks a lot Ali.
Kind regards
André
On Wednesday, 3 August 2016 at 18:15:23 UTC, Anonymouse wrote:
On Wednesday, 3 August 2016 at 17:16:10 UTC, Andre Pany wrote:
[...]
[...]
...is an alias for a delegate/function returning an Object. It
is analogous to
[...]
[...]
...is a function accepting an Object parameter. In main
Hi guys,
I'm trying to make a bridge between D and ruby with a gem called
ffi.
It's basically a loading/binding library that grab C function and
make them callable from Ruby code.
As you might already understand, i'm trying to develop extensions
using D and uses them in Ruby.
I tried to
On Wednesday, 3 August 2016 at 17:56:54 UTC, Jonathan M Davis
wrote:
int is comparable, but it's not going to index float[string].
Only a string is going to do that. Similarly, long is
comparable, but on a 32-bit system, it won't index int[],
because it's larger than size_t, which is the
On Wednesday, 3 August 2016 at 15:41:55 UTC, llaine wrote:
void foo(string str)
{
writeln(str);
}
shouldn't foo be:
void foo(char* str) {
import std.string;
writeln(str.fromStringz);
}
bye,
lobo
On Wednesday, 3 August 2016 at 13:44:46 UTC, llaine wrote:
Hi guys,
I'm trying to make a bridge between D and ruby with a gem
called ffi.
It's basically a loading/binding library that grab C function
and make them callable from Ruby code.
As you might already understand, i'm trying to
On Wednesday, 3 August 2016 at 13:49:36 UTC, bachmeier wrote:
Probably because you need the D runtime. One way is to import
core.runtime and call Runtime.initialize().
Where should I call this Runtime.initialize() ?
On Wednesday, 3 August 2016 at 13:44:46 UTC, llaine wrote:
void puts(string str)
{
writeln(str);
}
A D string isn't the same as a C string, so your params won't
work as-is, and writeln requires the D runtime to be initialized.
Does the ruby gem have a way to automatically call a
On Wednesday, 3 August 2016 at 08:12:00 UTC, Ali Çehreli wrote:
On 08/02/2016 07:55 PM, Mark J Twain wrote:
[...]
I didn't know one could use 'auto ref' in this case but the
following simple test works:
auto foo(Func, Args...)(Func callback, auto ref Args args) {
return callback(args);
34 matches
Mail list logo