Questions tagged [dmd]

Dmd stands for the Digital Mars D compiler.

The reference D compiler.

Usage:

Use as a generic tag.

199 questions
5
votes
1 answer

Why is readf not returning a value?

According to the documentation, readf is supposed to return a uint. But even this simple example fails to compile: hello.d import std.stdio; void main() { int x; uint r = readf("%s", &x); } error message: hello.d(5): Error: expression…
Benjamin Lindley
  • 101,917
  • 9
  • 204
  • 274
5
votes
1 answer

Why int x=08; is valid when int x=078; is invalid in `DMD`?

I was recently looking into the details of literals in the D programming language. Because octal literals use 0 as prefix to the numbers, int x = 078; is invalid naturally. But then why int x = 08; is valid in DMD? However, I have tested the same…
user4085386
5
votes
1 answer

Share Barrier across threads in D

I'm having a heck of a time trying to get the barrier sync in D to work properly. I'm currently not getting any compiler errors, however every time it reaches the barrier I get a segmentation fault. Here's basically what I have: import…
jdeters
  • 53
  • 3
5
votes
1 answer

How to pass object from D to C++?

I'm trying to make an interop with C++ and D. And the thing I've found today is really messing my mind: objects are not being passed correctly in my program. It's better to show an example. I have a C++ library, which I compile to an object file…
shybovycha
  • 11,556
  • 6
  • 52
  • 82
5
votes
1 answer

Why might rdmd not be running all unit tests?

Unfortunately I cannot seem to reproduce this behavior in a minimal working example, so this may be too vague. However, I can at least state what is not causing the behavior. I have a D module containing several classes with unit tests, with…
John Doucette
  • 4,370
  • 5
  • 37
  • 61
5
votes
2 answers

Which D compilers will perform tail-call optimization on this function?

string reverse(string str) pure nothrow { string reverse_impl(string temp, string str) pure nothrow { if (str.length == 0) { return temp; } else { return reverse_impl(str[0] ~…
Meta
  • 1,091
  • 6
  • 14
5
votes
4 answers

DMD 2 on Snow Leopard

Has anyone tried the Digitalmars D compiler (version 2) on Snow Leopard? I'd like to upgrade but I'd rather have a working D compiler.
ujh
  • 4,023
  • 3
  • 27
  • 31
5
votes
3 answers

Statically linking SQLite with DMD (Windows x86)

I've tried to statically link with sqlite3 without success. I'm using the 'etc.c.sqlite3' header, and the sqlite3 amalgamation. To create the .lib file I've tried both VC++ and MinGW-gcc, both of these compile the source file successfully - but they…
Elliott Darfink
  • 1,153
  • 14
  • 34
5
votes
1 answer

error instantiating redBlackTree template

I'm having trouble instantiating a RedBlackTree container with chars, but it works with ints: import std.stdio; import std.container; void main() { auto r1 = redBlackTree!(int)(); // works auto r2 = redBlackTree!(char)(); //…
YGL
  • 5,540
  • 2
  • 22
  • 19
4
votes
4 answers

struct to ubyte[] or ubyte[] to struct for d language

How the implementation of the struct in the D language to ubyte [] or ubyte [] to the struct, please brothers help answer this question, thank you! If a struct contains the string or char [] what to do? For example, such a structure: struct…
Dev Wolf
  • 55
  • 4
4
votes
3 answers

Remove white space characters from a char[] array in D

What is the recomended way to remove white space from a char[] in D. for example using dmd 2.057 I have, import std.stdio; import std.string; import std.algorithm; char[] line; int main(){ line = r"this is a line with spaces "; line =…
eastafri
  • 2,186
  • 2
  • 23
  • 34
4
votes
2 answers

How to painlessly initialize function pointers?

I want to load Win32 API functions using Runtime.loadLibrary and GetProcAddress(...). Using mixin: template GetProcA(alias func, alias name_in_DLL) { const char[] GetProcA = func ~ ` = cast(typeof(`~func~`))…
Tar
  • 8,529
  • 9
  • 56
  • 127
4
votes
1 answer

dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

Linking the following two files gives me a link-error: a.d: import std.stdio; extern string test (); void main() { writeln(test()); readln(); } b.d: string test () { return "hello"; } the error I get is: Error 42: Symbol Undefined…
Tar
  • 8,529
  • 9
  • 56
  • 127
4
votes
3 answers

D programming on Fedora 16

I've recently installed Fedora 16 (which is great), mostly because I wanted to try LDC2 but also because Gnome Shell runs much smoother on Fedora than Ubuntu 11.10 (at least on my hardware). LDC2 works great, but I'm wondering if, by outputting LLVM…
F i L
  • 760
  • 3
  • 12
4
votes
2 answers

Why aren't other modules being compiled?

I have two files: Main.d and ImportMe.d. Their purposes should be self-explanatory. They are in the same directory, and have no explicit module declaration. When I try to compile Main.d, though, I get a "symbols not found" error! $ dmd Main.d…
Maxpm
  • 24,113
  • 33
  • 111
  • 170
1 2
3
13 14