Re: opAssign and references
I am using DMD 2.057 on Ubuntu 64bit. Are you sure that it does not work? Can anyone reproduce the error? import std.variant; struct Foo { Variant a; ref Variant refA(){ return a; } } void main(){ Foo f1; f1.refA() = 24; } Compiles fine on Ubuntu x64 with git dmd and -m(32|64)
Re: i18n
I deduce so that there is no official support for that. If it's, it's a pain. Pain? Writing such a system can be done in a couple of lines.
Re: linker @ meaning and how to compile static libs
The main question is how do I either compile the library with the right version suffix (@12) Or get the linker to use the right version suffix (@8) That's no version suffix. It's the number of bytes of the arguments IIRC. Windows calling convention.
Re: i18n
Thanks a lot, So I just need to detect user locale using How to do that? You can always use the functions you would use in C.
Re: Struct inheritance
So why not just use classes? I've understood it as there may be a performance gain by using structs over classes, and in my program Point and Coordinate are used heavily. The other big difference is value vs. reference type. You can use alias this to achieve something like struct inheritance.
Re: Compiling Lua for D
LuaD works fine, but I'd rather learn to compile stuff like this myself. It will get me further in the long run^^ Try to switch to gdc. dmc, optlink Co. must die a bloody death anyway :)
Re: D for game Development
Can I use OpenGL or DirectX with D? Of course. E.g. there's a D1 game engine: http://yage3d.net I think http://3d.benjamin-thaut.de/?p=16 is D2, but it's rendering code only.
Re: Compiling Lua for D
I guess GDC uses COFF? That would definitely be handy... although I couldn't compile and debug from VS anymore in that case, and that would be unfortunate^^ Just recently Rainer added gdc support to cv2pdb.
Re: Everything on the Stack
scope auto e1 = new EntryInt(); Foo = e1.toFoo(); You don't need auto there. And scope is deprecated, use std.typecons' scoped
Re: Executable size when compiling with GDC
Lots of symbols and stuff. You can get it down with -ffunction-sections -fdata-sections -Wl,-s,--gc-sections Phobos should also be compiled with -ffunction-sections -fdata-sections to get the whole effect though.
Re: Make alias parameter optional?
void foo(T, T2, alias thing = (){})(T a, T2 b) { thing(); } void bar(){} void main() { foo!(int,int,bar)(1,2); foo(1,2); }
Re: produced binary is quite big
You may try -L--gc-sections (in case of gdc in combination with -ffunction-sections -fdata-sections) and -L-s
Re: Random behavior using a wrapped C library
http://d.puremagic.com/issues/show_bug.cgi?id=5570
Re: Random behavior using a wrapped C library
A blocker for using x64 on linux then. Use gdc. Better codegen anyway.
Re: Dumb question about git
OK, so what's the right way to do it then? I have some changes in a branch, but master has been updated since, so I want to merge in the latest updates so that the branch changes are compatible with the latest code. I use a quite crappy way to rebase my feature branch: git stash git checkout master git pull -v --rebase git rebase master myworkingbranch There's probably some redundancy or whatever here, but at least it works ^^
Re: htod - const
Why is 'const' removed? cause htod sucks. D1 didn't have const and htod wasn't updated for ages.
Re: htod - const
Am 06.03.2012, 20:13 Uhr, schrieb maarten van damme maartenvd1...@gmail.com: I wouldn't say that it sucks. It has really helped a lot in porting some simple header files. It goes terribly bad on the more complex though. Sadly, using regular expressions is much more efficient. At least those don't destroy the source by removing const, comments, evaluating preprocessor directives, etc.
Re: preprocessor pass equivalent?
There's a pull request to help with debugging string mixins: https://github.com/D-Programming-Language/dmd/pull/426
Re: Vector operations optimization.
What is the status at the moment? What compiler and with which compiler flags I should use to achieve maximum performance? In general gdc or ldc. Not sure how good vectorization is though, esp. auto-vectorization. On the other hand the so called vector operations like a[] = b[] + c[]; are lowered to hand-written SSE assembly even in dmd.
Re: anything that would provide support for zip filesystem?
I guess Tango provides something like that via the VFS stuff. https://github.com/SiegeLord/Tango-D2 resp. https://github.com/mtachrono/tango
Re: Vector operations optimization.
The flags you want are -O, -inline -release. If you don't have those, then that might explain some of the slow down on slicing, since -release drops a ton of runtime checks. -noboundscheck option can also speed up things.
Re: D Dll injection problem
Maybe it's because I have no def file. Very possible. Just pass it to dmd like the other files. Or try the new -shared flag.
Re: D Dll injection problem
I inject it but it returns nothing and the App(where the dll is injected) is hanging( not responding). Could you try it maybe? I would like to know whether it's a Problem with D or with me. Are dlls without injection working?
Re: this() const
Am 15.04.2012, 21:20 Uhr, schrieb sclytrack sclytr...@hotmail.com: this( const size_t step) const { this.step = step; } Error: cannot modify const/immutable/inout expression this.step Is this the expected behavior? Thanks. Yep.
Re: How to pass list of strings as compile-time parameters?
bool compareByMemb(string[] ignores, T)(T obj1, T obj2) { foreach (name; __traits(getAllMembers, T)) { ... } In this particular case you could try foo(T, U...)(T obj1, T obj2, U ignores)
Re: undefined reference - Derelict2
Though I was under the impression that the new Derelict2 hierarchy / d interface files in Derelict2/import reduced the neccesity for command line arguments, that is a Derelict related question. You may try to use --chatty and compare the output.
Re: std.mmfile issues
I found out that OpenFileMapping is not needed and CreateFileMapping is sufficient. I managed to code this with std.c.windows only however MmFile is not working even with simplest examlple maybe a bug under win 7? Possible. Feel free to file a bug report or create a pull request.
Re: align(16) struct member throws an exception with movdqa
test code please
Re: align(16) struct member throws an exception with movdqa
import std.stdio, core.simd; void main() { int4 v; } Internal error: ..\ztc\cgcod.c 1447 Building Debug\dtest1.exe failed! Works fine on Linux. Maybe the 32Bit check doesn't work for Windoze? -m32 on Linux yields Error: SIMD vector types not supported on this platform
Re: align(16) struct member throws an exception with movdqa
I think it has been fixed for the next version of DMD already. Any idea why align isn't letting me use movdqa? Cause align doesn't work the way you think it does. In fact I still don't understand how it works at all.
Re: Casting the Result of splitter() into a string array
If you want to convert a range to an array, use std.array.array This is a constant source of confusion and it also is a crappy design to use a function in a totally different module for this purpose imho. Can't these Result types get an eval() method and/or be made implicitly convertible to an array where appropriate? The C++ matrix library Eigen uses this approach and it works out fantastically. a*b returns an object representing this expression. If I do want to use this I write 'auto c=a*b;'. If I want the result I can explicitly use its eval() method (which is especially useful inside a bigger expression) or something like 'Matrix c=a*b;' which also evaluates the expression.
Re: Lack of warning messages
A notice for some unused imports would be great too... You could create a brute-force tool. Rip off an import statement at a time and see if it still compiles. One could probably modify DustMite to do that.
Re: Debugging compiler crashes?
dmd: glue.c:542: virtual void FuncDeclaration::toObjFile(int): Assertion `semanticRun == PASSsemantic3done' failed. Aborted wouter@carillon:~/code/d/DustMite$ ... and I'm not yet that fluent in D to understand what's going on. Any ideas? pass dustmite.d before dsplit.d known problem, but the error message has changed
Re: Debugging compiler crashes?
... the order of files matters? Yuck. Yep it's a bug.
Re: use of Class Invariants
That is what I am missing, a stack trace. How do I see a stack trace? dmd1(win) Well tango includes stack traces if you import the right module. For D2/Win use http://3d.benjamin-thaut.de/?p=15
import inside a class overrides symbols imported in module scope?
It was quite hard to track that one down. In the following example the import statement was mixed into the class among other code so it wasn't as obvious as here. import std.traits; class Foo { import std.string; static assert(isNumeric!int); } foo.d(6): Error: template instance isNumeric is not a template declaration, it is a function foo.d(6): Error: static assert (isNumeric!(int)) is not evaluatable at compile time (There's an isNumeric function in std.string) Local variables override global ones, but is this correct as well?
Re: How to get 'import' clauses from d file?
I'm trying to make some home-grown d build system, but and one of my tasks is to get module dependencies. Yes, I know about -deps DMD switch, but it works when all needed modules are given to compiler. But if some dependencies absent compiler just aborts with error module foo is in file foo.d that can not be read. Of course, I can extract foo from this string, deal with it and repeat, but working one module at a time is not a much fun. Seems like I need to parse d source and extract import clauses without compiler help - but may be I missed something? And if not - what tools can I use for parsing? You might look up how xfBuild uses the deps parameter to get all needed modules.
Re: Assigning Interface to Object
module testObj; public interface testInterface { void someMethod(); } public class testObj { Object someCaller; this(Object caller) { someCaller = caller; } this(testInterface tI, bool xyz) { someCaller = tI; } } Shouldn't this work? Doesn't really make sense. If you cast it to Object you loose the interface methods.
Re: Link with C static library
Should I change my C compiler? Or, there is another way to covert static library from COFF to OMF?? coff2omf should work, but unfortunately it isn't free. coffimplib is free, but can only convert import libraries. You may try to use objconv: http://www.agner.org/optimize/#objconv Though it doesn't work in all cases. Compiling with dmc solves the issue but is often tedious cause headers are different etc. Easiest solution if you can't do it statically is to use dlls.
Re: Link with C static library
I used it to convert static library, and it says the input library is not import library. That's coffimplib. coff2omf is in the Extended Utilities Package which is sold for 15$. Many existing C libraries are not written as dynamic libraries. Some C libraries can be compiled as DLL, but in performance critical application, such as games, they must use static link to increase performance. I hope there is a good solution for linking C static libraries. Well maybe Walter will give away coff2omf (and maybe obj2asm too) for free some day to solve this problematic situation. As I said, either you buy coff2omf, try objconv or compile with dmc.
Re: Development blog? D news?
http://planet.dsource.org/ Problem is: it's not very active, and also, apparently people don't know about it :-) Yeah haven't heard of it in all those years!
Re: Using D libs in C
Also make sure you use globals properly if you use them (shared, __gshared, etc.)
Strange phobos errors
Currently I'm getting some strange phobos errors when trying to compile my project: C:\dmd\windows\bin\..\..\src\phobos\std\functional.d(177): Error: static assert Bad binary function q{a == b}. You need to use a valid D expression using symbols a of type dchar and b of type const (char)[]. C:\dmd\windows\bin\..\..\src\phobos\std\functional.d(180): instantiated from here: Body!(dchar,const(char)[]) C:\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(2149): instantiated from here: result!(dchar,const(char)[]) The only phobos modules I directly use are std.string, std.traits and std.stdio. Has anybody else encountered this? (dmd 2.051) I already disabled unittests but this didn't help. (my code is at http://bitbucket.org/trass3r/cl4d)
Re: Strange phobos errors
http://d.puremagic.com/issues/show_bug.cgi?id=5373
Re: Assigning Interface to Object
Object is only the base class for all D classes. Interfaces may also represent COM objects or C++ classes, which are not subclasses of Object. Can't the compiler check if it is a normal D interface and then allow (implicit) casts to Object?
Re: Source code annotations alla Java
class Foo { int x; int y; int z; mixin NonSerialized!(z); } Had a quick look at http://dsource.org/projects/orange/browser/orange/serialization/Serializable.d 1. How come it works without 'mixin' in the template declaration (mixin template NonSerialized)? 2. What if several fields need to be tagged? 3. Is there a reason to use a struct instead of e.g. __nonSerialized = [field1, field2, ...]? 4. Couldn't that field be static to save space or maybe even enum?
Re: Source code annotations alla Java
template foo (args...) {} Does that work with aliases? Well at least the following compiles: template Foo(T...,) { int i; } int a,b; alias Foo!(a,b) f;
Re: Assigning Interface to Object
Speaking of COM.. has anyone successfully used COM interfaces in D2? I once tried to create a DDraw proxy dll but I can't remember how good it worked. https://bitbucket.org/trass3r/ddrawproxy
Re: Anyone have a clue how to download the Orange repository?
The problem is it uses a Mercurial repository.
template this parameters
Why do they exist and why does typeof(this) strip constness? import std.stdio; struct S { const void foo(this T)(int i) { writeln(typeid(T)); } const void bar() { writeln(typeid(typeof(this))); } } void main() { const(S) s; (s).foo(1); S s2; s2.foo(2); immutable(S) s3; s3.foo(3); s.bar(); s2.bar(); s3.bar(); } yields: const(templatethis.S) templatethis.S immutable(templatethis.S) templatethis.S templatethis.S templatethis.S
Re: template magic
2. What is the reason for Phobos defining param funcs as template params? Correct me if I'm wrong but there's no way to pass an arbitrary function to a function in a type-safe way. If you use pointers and casts you can't check if the passed function meets certain requirements (parameters, return type, attributes, etc.) 3. What is the meaning of 'alias f'? How does it work? This is a totally enigmatic feature for me. Seems it allows placing anything of any type as template param. http://digitalmars.com/d/2.0/template.html#TemplateAliasParameter It allows you to pass any D symbol. As the name already suggests, think of it as being a template-local alias to a symbol passed in the instantiation (but note that you can also pass literals as arguments to alias parameters).
Re: template magic
How do you not pass them in a safe manner? If you are casting things, of course you don't get type safety. Yep, I was talking about non-template functions. Only way to pass an arbitrary function is via void*
shared library loader (wrapper for GetProcAddress Co)
I can't seem to find something like that in phobos. Is it missing or am I overlooking it?
Re: How can you read and understand the source of *naryFun in functional.d?
Save this somewhere or it will be lost here ;)
Re: C# interop
As Simen said, there was an attempt to create an IL backend but it hasn't been updated since Aug 2009 and even it compiled you probably wouldn't have much fun with it. You could try to use a C bridge. But even then, I don't see the benefit.
Re: Debugging D?
Are debug symbols compiled with -gc stored in a separate file? Visual Studio refuses to debug my things Nope. Plus you need to use cv2pdb to debug with Visual
Re: Invoke garbage collector?
However, I need the resources to be freed more quickly than the GC is apparently doing You could use scoped instances if you need to clean them up soon after creation.
Re: OpenGL in D2
I've found a few OpenGL projects, like bindings (http://www.dsource.org/projects/bindings/) and derelict (http://www.dsource.org/projects/derelict/), but I still can't find any way to easily use or install them (for D2 on Ubuntu). Use derelict2 from svn and xfBuild. Then you just need to tell dmd where derelict is via -I I'd have thought that, since D interfaces so well with C, just using C libraries wouldn't require specific wrapper libraries, but it seems an automated method for converting C headers to D isn't currently possible? Derelict does a lot more, it hides all the nasty handling of different OpenGL versions that might be installed along with extension loading. To my knowledge there are several tools to convert C headers to D import modules: - htod, which is crappy. Since it's based on dmc, it nearly always complains about header files and the like; it doesn't translate preprocessor conditional compilation to versions or static if and almost always messes something up (const or whatever, can't remember) - SWIG, which I haven't tried yet for that purpose. But I think it will have the same problem with preprocessor conditional compilation. - c2d, don't know how good it works: http://dsource.org/projects/visuald/browser/trunk/c2d - bcd, which is obviously abandoned: http://www.dsource.org/projects/bcd
%x and floats
Why doesn't this work: import std.stdio; void main() { float a,b=0; writefln(%x %x, a, b); } std.format.FormatError: std.format floating
Re: Ini parsing library in D ?
http://www.dprogramming.com/ini.php
Re: How-to manipulate a C array with D2 vector operations?
I am trying to implement a D2 function that has this C signature (it gets called from a C module and I cannot change the caller): extern(C) read_into(char *buffer, size_t buf_len); I would like to use D's vector (or array-wise according to TDPL) operations on buffer but I cannot find a way, how I could initialize a auto darray = buffer[0 .. buf_len]
Re: About const and C functions
Am 01.03.2011, 23:33 Uhr, schrieb bearophile bearophileh...@lycos.com: Do you know why DMD doesn't give a compilation error here? import core.stdc.stdio: sscanf; immutable int value = 5; void main() { sscanf(10.ptr, %d.ptr, value); } What's the D signature of sscanf?
Re: Iterating a typle tuple of templates
bearophile Wrote: It seems t is not useful... Yep, foreach over tuples is kinda messed up. Same with reference tuple foreach: http://d.puremagic.com/issues/show_bug.cgi?id=2411 Direct access doesn't work but accessing via [i] does.
Re: enum with classes/structs
... or does enumerations only support constant-expressions? Thanks! Yep, enum is a compile-time thing.
Re: Help passing D strings to C libs
I'm having trouble passing D strings (char[]) to SDL, in particular SDL_LoadBMP(), I keep receiving a segfault. Heres the code: void setImg(string path) { // concat null terminating char to string and cast to c type string when // passing to SDL_LoadBMP() path ~= \0; image = SDL_LoadBMP( cast(char*)path ); } and the value of path is ./resources/cannon.bmp I'm using SDL 1.2.14 and DMD 1.067 on Ubuntu 10.10 Well strings are put into read-only space on Linux and I guess this is also the case for D1. Since you are doing a ~= it probably tries to alter that value and crashes. You should use something like SDL_LoadBMP(cast(char*)(path ~ \0)) if you really wanted to convert it manually. But the proper way to convert a string to a C char* is to use toStringz.
Re: Best practice for strings across D1 and D2
nedbrek Wrote: 2) What is the best way to make the same declarations work for D1 and D2? It seems everything inside a version statement must parse correctly, and D1 doesn't want to parse immutable(char)... You may also use versioned aliases. Just include the D2 code via a string mixin to circumvent the parsing problem.
Re: Want to help DMD bugfixing? Write a simple utility.
Is there a copy of the official D grammar somewhere online? I wrote a lexer for my Compiler class and would love to try and apply it to another grammar. The official D grammar is spread among the specification. But I recall that someone compiled a complete grammar for D1 some time ago.
Re: object.d: Error: module object is in file 'object.d' which cannot be read
object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /etc/../../src/phobos import path[1] = /etc/../../src/druntime/import As you can see dmd.conf uses relative paths. That guide needs an overhaul. The easiest way is to copy the contents of the zip archive into some local dmd directory and add dmd/linux/bin to your PATH. (i.e. remove your etc/dmd.conf for now)
Re: object.d: Error: module object is in file 'object.d' which cannot be read
object.d: Error: module object is in file 'object.d' which cannot be read Specify path to file 'object.d' with -I switch Could it be you also deleted the dmd.conf in the local dmd/linux/bin?
Re: correct way to create boiler plate code
string[] funcs = [tan]; calling mixin a compile time has the following error... Error 1 Error: variable func cannot be read at compile time C:\D\SVNProjects\trunk\xcellD\xcell1\trig.d 22 That's because funcs is mutable. Try to make it immutable or enum.
Re: correct way to create boiler plate code
foreach runs at runtime, while mixin is expanded at compile time. Not the whole truth though. foreach over tuples gets unrolled at compile time so you can do stuff like: // +=, -=, ... Vector opOpAssign(string op, U)(U s) { foreach (i, _; tuple) mixin(tuple[i] ~ op ~ = s;); return this; }
Re: Memory corruption rant.
Could it be a stack corruption?
Re: status of shared-libs on Windows?
Am 19.05.2011, 22:28 Uhr, schrieb Graham Fawcett fawc...@uwindsor.ca: Hi folks, I've only used D on Linux so far, so I'm not clear on the current shared-library story on Windows. Consider an existing C++ application that can be extended by writing plugins, which are usually written in C or C++, and compiled as DLLs. Very generally speaking, is DMD capable of producing DLLs that could be used by such an application? Yep. Just be sure to use dll_helper as described in http://www.digitalmars.com/d/2.0/dll.html to intialize the runtime properly. If so, should I expect runtime-related issues if I create multiple plugins with DMD, and load them all into the app? Never tried that.
Re: status of shared-libs on Windows?
(I've already successfully created and used Matlab .mex/.dll plugins with D)
Re: status of shared-libs on Windows?
Thanks, Trass3r et al! I'll give it a try in D, then. Of course you can't create 64Bit dlls though ;)
Re: web development in D
Have a look at the recent thread titled 'How To Dynamic Web Rendering?' Adam Ruppe has created a package for web development with D and it seems to work like a charm.
Re: web development in D
Very interesting benchmarks!
Re: What are the reasons for this syntax??
Read about import types here: http://www.digitalmars.com/d/2.0/module.html#ImportDeclaration
Re: Linking with/Debugging static C/C++ libraries
Am 30.05.2011, 04:09 Uhr, schrieb Jeff Slutter mrmust...@gmail.com: One of the things that's important to us is being able to link against some existing C/C++ static libraries (built with VS 2008, so PE COFF format). Good luck with that. DLLs are no problem but static libraries are another story. objconv has never done the job for me. I'm surprised that it worked in your test. And compiling the code with dmc is a real PITA. Maybe dmd will finally switch to COFF output in the course of 64Bit transition but even then the 2 different compilers might generate incompatible code. There is a linker named Unilink though, which is reportedly able to link OMF and COFF files out of the box. But it doesn't even have a homepage, only an ftp server that's hard to find. Plus it's closed source so you can't assess whether it will continue to be developed, if it becomes commercial one day etc. For what it's worth, using GDC and GCC/MingW (TDM), I was able to build and debug a D/C/C++ mixed executable. I had to use GDB (though WinGDB works just dandy), but the downside is I'm not using Visual D (unless Visual D supports GDC??), nor DMD. DMD seems that it would be more supported and stable right now than GDC, which seems to play catch up. I worry that, as a user of GDC, hitting a compiler bug, would take longer to get an official fix for, than it would for DMD. GDC shares the frontend with dmd, so it will benefit from any FE bug fixed there. Regarding the glue code, it is currently maintained by Iain alone. He tends to be quite active though. OT: You are RD and still use Windoze? ;)
Re: Problem with dsss 0.78 rebuild error: out of memory
Both tools are dead.
Re: Is it reasonable to learn D
Am 07.06.2011, 23:02 Uhr, schrieb Fabian contact-...@freenet.de: I can't see any changes on this web page: http://www.dsource.org/projects/dwt/wiki That doesn't mean anything. Development sometimes takes place behind the scenes or in forks at github or bitbucket.
Re: Is it reasonable to learn D
- The D compiler has only bad code optimization Yep, but there is LDC and GDC which use LLVM and GCC as backends respectively. - There are no maintained GUI libraries I wouldn't agree with that. Some people are still working on GtkD, QtD and DWT. - The development of the compiler is very slow More and more people are contributing patches so development has definitely become faster. Also Don has more or less taken over development of the CTFE functionality. Nice trend. - Only a small community = no real German community There is no separate German community but there are plenty of Germans here. Manchmal sieht man sie nur nicht sofort ^^ So I ask you - Is it reasonable to learn D? Yeah, learning D is definitely worth it, if only to know why C++ and especially C++0x sucks ass ;) The language and its potential is just great. In my experience you shouldn't use D for a particular project though if you - have pressing deadlines, cause compiler bugs might become very painful. - depend on C++ libraries or have to code a module for a big C++ framework. I tried using SFML but wasted a lot of time writing the wrapper code instead of actual application code. Apart from that it's perfectly possible to accomplish non-trivial projects with D, be it against all odds like http://h3.gd/code/nucleus/
Re: Is it reasonable to learn D
http://h3.gd/code/nucleus/ I lol'd at the suggestion to upgrade my FF4 to a modern HTML5-compliant browser. ^^ No problems with Opera.
Re: Undefined function, even though imported
Importing it means dmd knows about the function and emits a call but doesn't automatically generate the function code. This is only done if you also pass the file containing it to dmd.
Re: Undefined function, even though imported
Shouldn't the linker/compiler be able to solve this on its own then? Use rdmd or xfBuild to automatically compile all needed modules.
Re: Undefined function, even though imported
Am 14.06.2011, 02:43 Uhr, schrieb Loopback elliott.darf...@gmail.com: Thanks for all the answers! Seems like rdmd did the trick. I don't see why this isn't built in to dmd though No one does ;) I've also stumbled upon an additional error with the win32 DirectX bindings, but this seems D related actually. When I compile any code at all (with rdmd) which imports win32.directx.d3d9 and uses the function Direct3DCreate9, the linker issues this warning: Error 42: Symbol Undefined _Direct3DCreate9@4 So the other functions in d3d9 work but only this one doesn't? Both of these links says that the problem is solved by adding _Direct3DCreate9 to imports. I've tried to do this by linking to a .def file with this content (without success, same error is still issued). EXETYPE NT SUBSYSTEM WINDOWS IMPORTS _Direct3DCreate9@4=d3d9.Direct3DCreate9 ^^ This can't work cause the linker knows nothing about D modules. You'd have to use the correct D mangled name.
how to reduce a debug symbol error?
Starting my cl4d executable with 'gdb main -readnow' results in Reading symbols from main...expanding to full symbols...Die: DW_TAG_type_unit (abbrev 4, offset 0x6a) parent at offset: 0xb has children: FALSE attributes: DW_AT_byte_size (DW_FORM_data1) constant: 16 DW_AT_type (DW_FORM_ref4) constant ref: 0x62 (adjusted) Dwarf Error: Missing children for type unit [in module main] How do you reduce/report such a bug?
Re: how to reduce a debug symbol error?
First: are you compiling *all* modules with -gc rather than -g? Ah ok, somehow I was mislead into thinking that the gdb patches allow you to use -g. It works now though line numbers are more messed up than I'm used to from cv2pdb + VS. There I only have the usual problems with mixins but here it even jumps around senselessly if I just do a step over. Don't know if this has to do with -gc or Descent. To do that, I recommend you unleash DustMite on your source: https://github.com/CyberShadow/DustMite. You'll need a script that can test for the bug too, you can pass a command file to gdb and grep for the relevant failure, alternatively if you can get the failure when using dwarfdump/objdump that may be easier. Yeah need to test that tool soon.
Re: Dynamic multidimensional arrays
If you want it to by dynamic all the way, you need to put the dimensions in the parens like above. Personally, I _never_ put them in the brackets, even when the dynamic array has just one dimension. It's just simpler to always put them in the parens and not worry about it. Maybe we should force the parens approach even for one dimension. At least dmd should give better diagnostics. It's damn hard to even find that syntax in the docs.
Re: translate a macro to D
Am 06.07.2011, 16:15 Uhr, schrieb teo teo.ubu...@yahoo.com: What is the best way to translate following to D? #define MAKELONG(a, b) \ ((LONG) (((WORD) (a)) | ((DWORD) ((WORD) (b))) 16)) The point is I would like to be able to use that at compile-time. The macro is supposed to define some constants. Just turn it into a function. If you assign it to an enum or use it as an initializer for global immutables it should be evaluated at compile-time.
Re: Declaring a D pointer to a C function
You should declare the function pointer without the extern(C). Example: alias int function(void* test) FTInitFunc; extern(C) int foo(void* test){ } FTInitFunc foo_ptr = foo; This worked for me. That's a bug.
template instance cannot use local 'f' as parameter to non-global template
Is this a bug? If not, how do you make it work? void h() {} class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(alias g = f)() { } } void main() { Bla b = new Bla(); b.blub(); } test.d(18): Error: template instance cannot use local 'f' as parameter to non-global template blub(alias g = f) test.d(18): Error: template instance forward reference of f test.d(18): Error: template instance test.Bla.wrap!(h).blub!(f) error instantiating
Re: Running DMD tests
Am 13.06.2011, 23:55 Uhr, schrieb Peter Alexander peter.alexander...@gmail.com: I'm trying to run the test suite for DMD, but I'm running into issues. Do I need to set up my environment differently to run dmd in development? How can I get around this? To quote IRC: In theory it's simple: go to dmd/test and run make. In practice you need to have druntime and phobos installed at the right places. I think if you clone dmd, druntime, and phobos and put them all in the same directory, then you build dmd, druntime, and phobos, then you should be able to run the test suite. you also need to have a dmd.conf that's not included with the suite : Ah, yeah, true. And since I remember I made my dmd.conf point to those places, maybe you don't need to have druntime and phobos there after all. But it's still a good idea to be able to get non-release druntime (and to some extent phobos) when playing with non-release versions of DMD.
Re: Running DMD tests
Am 12.07.2011, 20:57 Uhr, schrieb David Nadlinger s...@klickverbot.at: or use your normal system-wide installation which probably has all the paths set up correctly by specifying the DMD variable: »make DMD=/usr/local/bin/dmd«. Thanks a lot for that hint!
Re: Declaring a D pointer to a C function
Is this going to be fixed any time soon? Allowing callbacks with D calling convention where a C callback is expected should be an error, and this is like the 10th time I've ran into this bug. http://d.puremagic.com/issues/show_bug.cgi?id=3797
Re: template instance cannot use local 'f' as parameter to non-global template
Anybody an idea?
Re: template instance cannot use local 'f' as parameter to non-global template
Am 13.07.2011, 16:02 Uhr, schrieb Steven Schveighoffer schvei...@yahoo.com: void h() {} class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(alias g = f)() { g(); } } As a workaround, is there a reason you need blub to be parameterized? I mean, f is already part of the template. Yep, a default function is passed to wrap and in most cases blub just calls that one. But sometimes I need blub to use a function other than the default one.
Re: template instance cannot use local 'f' as parameter to non-global template
Am 13.07.2011, 16:58 Uhr, schrieb Tyro[a.c.edwards] nos...@home.com: Don't know it this is the right answer or a possible bug but it does the trick: void h() { import std.stdio; write(h()); } class Bla { mixin wrap!h; } mixin template wrap(alias f) { void blub(typeof(f) g = f) { g(); } } void main() { Bla b = new Bla(); b.blub(); } Thanks! Unfortunately it doesn't work with more complex functions: Error: arithmetic/string type expected for value-parameter, not cl_errcode C function(cl_program program, uint param_name, ulong param_value_size, void* param_value, ulong* param_value_size_ret)
Re: template instance cannot use local 'f' as parameter to non-global template
I've seen this error before... *searches memory and old code* Here you go: http://d.puremagic.com/issues/show_bug.cgi?id=3051 I think this is yet another issue. The inner template argument is not something on the stack but it is a template argument.
Re: Problems with static linking of c libraries
Am 14.07.2011, 16:36 Uhr, schrieb Danny Arends danny.are...@gmail.com: Hey all, I'm trying to build a D application which statically links in the the blas and lapack libraries (from http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html ). When downloading the pre-build libraries from the website I link them in using: You save yourself a lot of hassle if you just stick with dlls on Windoze. Converting prebuilt libs has never really worked for me. And compiling them with dmc is a nightmare. But creating an import library from a dll with implib worked really well so far no matter how the code was compiled.