A fun project might be to use D's reflection to automatically
generate any C binding translators to a nice D interface and the
Ruby file to access it.
I did something similar back in the day for PHP and JavaScript...
it would be kinda tricky to do it with best efficiency, but
getting it to wo
On Thursday, 4 August 2016 at 13:14:34 UTC, llaine wrote:
Here is my repo https://github.com/llaine/ruby-dlang
FYI: to!string is kinda slow. If you want to do a fast blank, you
should avoid conversions actually, I'm surprised it is faster
than the native Ruby one at all.
On Thursday, 4 August 2016 at 23:35:55 UTC, bachmeier wrote:
On Thursday, 4 August 2016 at 17:11:04 UTC, Adam D. Ruppe wrote:
Happy that you guys put this on the Wiki !!
On Thursday, 4 August 2016 at 17:11:04 UTC, Adam D. Ruppe wrote:
On Thursday, 4 August 2016 at 14:46:33 UTC, bachmeier wrote:
I'd like to put this example on the wiki unless you think
there is a reason to not do so.
cool. I'll prolly slap it in this week in D soon too (I've been
kinda short o
On Thursday, 4 August 2016 at 14:46:33 UTC, bachmeier wrote:
I'd like to put this example on the wiki unless you think there
is a reason to not do so.
cool. I'll prolly slap it in this week in D soon too (I've been
kinda short on material lately!)
On Thursday, 4 August 2016 at 13:14:34 UTC, llaine wrote:
I saw that your compiling using dmd with all thoses options.
Can you explain me what is the benefit of using this ?
I just don't use dub, I don't see the benefit of it, but if it
works for you, cool!
On Thursday, 4 August 2016 at 12:14:48 UTC, Adam D. Ruppe wrote:
On Thursday, 4 August 2016 at 10:36:05 UTC, llaine wrote:
Any idea how can I call them ?
Just like any other function. Consider this:
[...]
Compile
[...]
hi from D, Ruby user!
Thank you a lot!!! I want to use some vibe.d r
On Thursday, 4 August 2016 at 12:14:48 UTC, Adam D. Ruppe wrote:
On Thursday, 4 August 2016 at 10:36:05 UTC, llaine wrote:
Any idea how can I call them ?
Just like any other function. Consider this:
I'd like to put this example on the wiki unless you think there
is a reason to not do so.
On Thursday, 4 August 2016 at 13:14:34 UTC, llaine wrote:
I saw that your compiling using dmd with all thoses options.
Can you explain me what is the benefit of using this ?
very simple: avoiding dub. Adam is not using it.
On Thursday, 4 August 2016 at 12:14:48 UTC, Adam D. Ruppe wrote:
On Thursday, 4 August 2016 at 10:36:05 UTC, llaine wrote:
Any idea how can I call them ?
Just like any other function. Consider this:
--
hi from D, Ruby user!
Wow thank you Adam, it's pretty impressive.
I saw that yo
On Thursday, 4 August 2016 at 10:36:05 UTC, llaine wrote:
Any idea how can I call them ?
Just like any other function. Consider this:
--
// i.d
import std.stdio;
extern(C)
void hello() {
writeln("hi from D");
}
--
# d.rb
require 'rubygems'
require 'ffi'
module DIn
On Wednesday, 3 August 2016 at 16:09:15 UTC, bachmeier wrote:
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
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 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:
https://github.com/ffi/ffi/blob/ce0e712bcb8876620e10c89
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 sp
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 y
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 https://
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 foo(string
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 t
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.
But
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().
Wh
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 second
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
in
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 pa
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:
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 develo
27 matches
Mail list logo