Following function will return the reference to a object Foo
embedded in a Variant.
class Foo {}
Variant fun() {
Variant v;
v = new Foo();
return v;
}
According to the source code of VariantN.opAssign,
the assignment is done by:
memcpy(&store, &rhs, rhs.sizeof);
fptr =
On 03.01.2016 22:37, TheDGuy wrote:
If i rename "test.o" to "test.obj" i get:
'Error: Module or Dictionary corrupt'
My guess is, that means that dmd can't handle the object file format
that gcc produces.
Disclaimer: I don't know much about object formats, gcc, and Windows. I
may be mistake
On Sunday, 3 January 2016 at 18:53:10 UTC, Martin Tschierschke
wrote:
On Friday, 1 January 2016 at 00:14:08 UTC, Jason Jeffory wrote:
Vibe.d uses deit files for html generation. Seems nice but
haven't dived into it(just removes a but of nonsense and
allows code integration for dynamic generatio
On Sunday, 3 January 2016 at 21:20:35 UTC, anonymous wrote:
On 03.01.2016 21:32, TheDGuy wrote:
If i type:
gcc -c -otest.c.o
the 'test.c.o' file is generated but if i type:
dmd main.d test.c.o i get: 'Error: unrecognized file extension
o'?
You're probably on Windows then? dmd doesn't recogn
On 03.01.2016 21:32, TheDGuy wrote:
If i type:
gcc -c -otest.c.o
the 'test.c.o' file is generated but if i type:
dmd main.d test.c.o i get: 'Error: unrecognized file extension o'?
You're probably on Windows then? dmd doesn't recognize the .o extension
on Windows, use .obj instead.
Use an import.
import std.string;
import std.conv;
void main(string[] args) {
auto value = toStringz("Hello World");
auto result = write(value);
auto s = to!(string)(result);
writeln(s);
}
Also all string literals in D are zero terminated so you could
write the call like
On Sunday, 3 January 2016 at 19:24:46 UTC, TheDGuy wrote:
On Sunday, 3 January 2016 at 13:25:04 UTC, Gary Willoughby
wrote:
On Sunday, 3 January 2016 at 13:23:25 UTC, Gary Willoughby
wrote:
I think I've noticed one problem with the code above. You are
using `text.ptr`. You shouldn't do that bec
On 2016-01-03 18:48, Steven Schveighoffer wrote:
class constructor requirements are much different from struct
constructor requirements. There's also no implicit constructor that
initializes all members as there is for structs.
To clarify, there's a default (implicit) constructor that initiali
On Sunday, 3 January 2016 at 13:25:04 UTC, Gary Willoughby wrote:
On Sunday, 3 January 2016 at 13:23:25 UTC, Gary Willoughby
wrote:
I think I've noticed one problem with the code above. You are
using `text.ptr`. You shouldn't do that because you are
passing a pointer not an array. Just use `tex
On Friday, 1 January 2016 at 00:14:08 UTC, Jason Jeffory wrote:
Vibe.d uses deit files for html generation. Seems nice but
haven't dived into it(just removes a but of nonsense and allows
code integration for dynamic generation... sounds great!!).
But what about visual editing? It's nice to be
On Saturday, 2 January 2016 at 00:15:32 UTC, Jason Jeffory wrote:
Ok, So Deit allows D code inside html... looks great.
But how do external variables work? If I create a variable in
the server(such as a class), can an html file access it easily?
(not having to jump through hoops)
doctype ht
On Sunday, 3 January 2016 at 17:30:15 UTC, Dibyendu Majumdar
wrote:
Does CMake recognise D in the enable_language command?
No.
If not is there a workaround?
I have a fork of CMake that adds D support here:
https://github.com/trentforkert/cmake
It's been a while since I published updates, b
On 1/1/16 9:08 PM, Shriramana Sharma wrote:
John wrote:
It's nothing to do with the @property attribute. So you need to
define a constructor. Also, use "new" when creating instances.
Thanks Simon and John. First actual usage of D classes and mistaken
assumption that C++ syntax is valid. :-)
Does CMake recognise D in the enable_language command?
If not is there a workaround?
Thanks and Regards
Dibyendu
On Sunday, 3 January 2016 at 16:44:35 UTC, tsbockman wrote:
If it's a private internal data structure which is only used a
few places, then sure - just use the minimum code required to
get the job done.
But, if it's a part of the public API for a module and the
class logically has a natural o
On Sunday, 3 January 2016 at 16:25:31 UTC, Tobi G. wrote:
On Sunday, 3 January 2016 at 14:49:59 UTC, tsbockman wrote:
Anyway, it's not too hard if you understand what's going on,
and all of the functions I added are good things to have
anyway, because lots of generic code expects some or all of
On Sunday, 3 January 2016 at 14:49:59 UTC, tsbockman wrote:
On Sunday, 3 January 2016 at 10:55:05 UTC, AntonSotov wrote:
import std.container.rbtree;
class myClass {
string str;
}
int main()
{
auto tree = new RedBlackTree!myClass;
return 0;
}
Error: mutable method object.Object.
tsbockman,
Many thanks! Now I work for me
On Sunday, 3 January 2016 at 10:55:05 UTC, AntonSotov wrote:
import std.container.rbtree;
class myClass {
string str;
}
int main()
{
auto tree = new RedBlackTree!myClass;
return 0;
}
Error: mutable method object.Object.opCmp is not callable using
a inout object
Error: template i
On Sunday, January 03, 2016 10:55:05 AntonSotov via Digitalmars-d-learn wrote:
> import std.container.rbtree;
>
> class myClass {
> string str;
> }
>
>
> int main()
> {
> auto tree = new RedBlackTree!myClass;
> return 0;
> }
>
>
> Error: mutable method object.Object.opCmp is not call
Thanks library now compiles.
On Sunday, 3 January 2016 at 13:45:13 UTC, anonymous wrote:
On 03.01.2016 14:30, data pulverizer wrote:
I am trying to access functionality in the glpk C library using
extern(C). It has graph structs in its header file that are
specified in
an odd recurring manner
On Sunday, 3 January 2016 at 03:41:12 UTC, Jack wrote:
I didn't actually knew it works that way because last time I
tried using '==' directly it won't compare.
Well, there are always many ways that things can go wrong
(including compiler bugs), but it SHOULD work, so ask on the
forums if it d
On 03.01.2016 14:30, data pulverizer wrote:
I am trying to access functionality in the glpk C library using
extern(C). It has graph structs in its header file that are specified in
an odd recurring manner that I cannot reproduce in D:
I don't see what's odd about this. What exactly are your str
Dear D Gurus,
I am trying to access functionality in the glpk C library using
extern(C). It has graph structs in its header file that are
specified in an odd recurring manner that I cannot reproduce in D:
typedef struct glp_graph glp_graph;
typedef struct glp_vertex glp_vertex;
typedef struct
On Sunday, 3 January 2016 at 13:23:25 UTC, Gary Willoughby wrote:
I think I've noticed one problem with the code above. You are
using `text.ptr`. You shouldn't do that because you are passing
a pointer not an array. Just use `text`.
Forget this line, my mistake. Use `toStringz` and pass a poin
On Sunday, 3 January 2016 at 12:30:34 UTC, TheDGuy wrote:
I get an access violation with this code:
...
There are a few things you can do to improve your code to make it
easier to debug.
1. When converting a D string to a char pointer for use with C,
use `std.string.toStringz`:
http://dl
On 03.01.2016 14:12, anonymous wrote:
You shouldn't get a segfault, though. You should get some compile/link
error. Are you compiling the right files? Can the segfault be from
something other than your program?
Oh, I see what's probably happening:
You compile the D program, but you don't compi
On 03.01.2016 14:01, TheDGuy wrote:
Okay, i think this C code should work (checked with cpp.sh):
#import
char* write(char* text){
return text;
}
int main(void){
return 0;
}
Uh, no. 1) In C it's include, not import. 2) Now you have two main
functions, that can't work.
You shouldn'
On 04/01/16 12:42 AM, Arialis Majoris wrote:
On Sunday, 3 January 2016 at 08:29:22 UTC, Rikki Cattermole wrote:
On 03/01/16 9:26 PM, Arialis Majoris wrote:
On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote:
On 03/01/16 7:04 PM, Arialis Majoris wrote:
[...]
It's really quite
Works for me after adding the needed imports and removing the
wrong include from the C file. Is this really the actual code
you're running? Doesn't your C compiler reject that include?
gcc does.
Okay, i think this C code should work (checked with cpp.sh):
#import
char* write(char* text){
On 03.01.2016 13:30, TheDGuy wrote:
I get an access violation with this code:
extern(C) char* write(char* text);
void main(string[] args){
char[] text = "Hello World".dup; //.dup converts string to char[]
text ~= '\0'; //append
char* result = write(text.ptr); //you need .ptr
I get an access violation with this code:
extern(C) char* write(char* text);
void main(string[] args){
char[] text = "Hello World".dup; //.dup converts string to char[]
text ~= '\0'; //append
char* result = write(text.ptr); //you need .ptr
const(char)[] s = cstr2
On Sunday, 3 January 2016 at 08:29:22 UTC, Rikki Cattermole wrote:
On 03/01/16 9:26 PM, Arialis Majoris wrote:
On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole
wrote:
On 03/01/16 7:04 PM, Arialis Majoris wrote:
[...]
It's really quite simple.
You would probably only need like 2 re
import std.container.rbtree;
class myClass {
string str;
}
int main()
{
auto tree = new RedBlackTree!myClass;
return 0;
}
Error: mutable method object.Object.opCmp is not callable using a
inout object
Error: template instance std.functional.binaryFun!("a < b", "a",
"b").binaryFu
On Friday, 27 November 2015 at 00:17:34 UTC, brian wrote:
3) pre- or post-pend the salt to the password entered
(apparently there is a difference??)
Sorry to revive an old thread, but I wrote a blog post about this
question:
https://theartofmachinery.com/2016/01/03/What%20Difference%20Can%20Ord
On 03/01/16 9:26 PM, Arialis Majoris wrote:
On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote:
On 03/01/16 7:04 PM, Arialis Majoris wrote:
I have a rather large header file used to write plugins for reaper:
http://pastebin.com/Eebv1e0M
This file, unfortunately may change quite
On Sunday, 3 January 2016 at 06:07:09 UTC, Rikki Cattermole wrote:
On 03/01/16 7:04 PM, Arialis Majoris wrote:
I have a rather large header file used to write plugins for
reaper:
http://pastebin.com/Eebv1e0M
This file, unfortunately may change quite often depending on
the version
of reaper.
37 matches
Mail list logo