Re: Strange stack variable corruption error after calling extern(C) function

2017-04-14 Thread Lewis via Digitalmars-d-learn
On Tuesday, 3 May 2016 at 19:06:30 UTC, cc wrote: I see, thanks. Double checking the original headers, I see the function is defined as: FMOD_RESULT F_API FMOD_System_CreateSound (FMOD_SYSTEM *system, const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo,

Re: Why map return [] ?

2017-04-14 Thread Suliman via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:55:13 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 15:49:00 UTC, Suliman wrote: I found problem! ResultRange should be converted to array before it can be `map`ed That shouldn't be necessary. Can you post your complete code? ResultRange

Re: Deduplicating template reflection code

2017-04-14 Thread Moritz Maxeiner via Digitalmars-d-learn
On Friday, 14 April 2017 at 17:57:49 UTC, Johannes Pfau wrote: Am Fri, 14 Apr 2017 13:41:45 + schrieb Moritz Maxeiner : [...] Great, thanks that's exactly the solution I wanted. Figuring this out by myself is a bit above my template skill level ;-) -- Johannes

Re: Compilation problems with GDC/GCC

2017-04-14 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 14 Apr 2017 13:03:22 + schrieb DRex : > On Friday, 14 April 2017 at 12:01:39 UTC, DRex wrote: > > > > the -r option redirects the linked object files into another > > object file, so the point being I can pass a D object and a C > > object to the linker and

Re: Deduplicating template reflection code

2017-04-14 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 14 Apr 2017 13:41:45 + schrieb Moritz Maxeiner : > On Friday, 14 April 2017 at 11:29:03 UTC, Johannes Pfau wrote: > > > > Is there some way to wrap the 'type selection'? In pseudo-code > > something like this: > > > > enum FilteredOverloads(API) = ... > > > >

Re: cmake-d and gdc/gdmd compiler

2017-04-14 Thread timvol via Digitalmars-d-learn
On Tuesday, 4 April 2017 at 19:59:19 UTC, Dragos Carp wrote: On Tuesday, 4 April 2017 at 18:42:45 UTC, timvol wrote: Hi guys, I'm trying to cross-compile a project using CMake and gdc (or better: the gdmd port). My CMakeLists-file is the following: For cross-compiling, CMake uses a so

Re: Why map return [] ?

2017-04-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:49:00 UTC, Suliman wrote: I found problem! ResultRange should be converted to array before it can be `map`ed That shouldn't be necessary. Can you post your complete code?

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:42:33 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:40:18 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 15:31:21 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:22:49 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 09:49:09 UTC, Suliman

Re: Why map return [] ?

2017-04-14 Thread Suliman via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:38:19 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:35:15 UTC, cym13 wrote: On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote: auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Suliman via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:40:18 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 15:31:21 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:22:49 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 09:49:09 UTC, Suliman wrote: on: dub build --compiler=ldc2 link OPTLINK (R)

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:31:21 UTC, Suliman wrote: On Friday, 14 April 2017 at 15:22:49 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 09:49:09 UTC, Suliman wrote: on: dub build --compiler=ldc2 link OPTLINK (R) for Win32 Release 8.00.17 Optlink isn't able to link object

Re: Why map return [] ?

2017-04-14 Thread Suliman via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:35:15 UTC, cym13 wrote: On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote: auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return data line by line. Why? What library is that supposed

Re: Why map return [] ?

2017-04-14 Thread cym13 via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:29:33 UTC, Suliman wrote: auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return data line by line. Why? What library is that supposed to be?

Cannot build dfix, dcd with dub

2017-04-14 Thread Domain via Digitalmars-d-learn
I use the latest dmd. It seems dub fetch the wrong dependencies C:\Domain\d>dub build dfix --build=release Building package dfix in C:\Users\Domain\AppData\Roaming\dub\packages\dfix-0.3. 1\dfix\ Fetching experimental_allocator 2.70.0-b1 (getting selected version)... Fetching libdparse 0.3.0

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Suliman via Digitalmars-d-learn
On Friday, 14 April 2017 at 15:22:49 UTC, Rene Zwanenburg wrote: On Friday, 14 April 2017 at 09:49:09 UTC, Suliman wrote: on: dub build --compiler=ldc2 link OPTLINK (R) for Win32 Release 8.00.17 Optlink isn't able to link object files produced by ldc. Could you try an x64_86 build?

Why map return [] ?

2017-04-14 Thread Suliman via Digitalmars-d-learn
auto x = MySQLTablesRange.map!(a=>a); writeln(x); return: [] while next code: MySQLTablesRange.each!(a=>a.writeln); return data line by line. Why?

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 14 April 2017 at 09:49:09 UTC, Suliman wrote: on: dub build --compiler=ldc2 link OPTLINK (R) for Win32 Release 8.00.17 Optlink isn't able to link object files produced by ldc. Could you try an x64_86 build? You'll need the Microsoft linker.

Re: Deduplicating template reflection code

2017-04-14 Thread Moritz Maxeiner via Digitalmars-d-learn
On Friday, 14 April 2017 at 11:29:03 UTC, Johannes Pfau wrote: Is there some way to wrap the 'type selection'? In pseudo-code something like this: enum FilteredOverloads(API) = ... foreach(Overload, FilteredOverloads!API) { } Sure, but that's a bit more complex: --- [...] //

Re: Compilation problems with GDC/GCC

2017-04-14 Thread DRex via Digitalmars-d-learn
On Friday, 14 April 2017 at 12:01:39 UTC, DRex wrote: the -r option redirects the linked object files into another object file, so the point being I can pass a D object and a C object to the linker and produce another object file. As for linking D files, do you mean passing the druntime

Re: Compilation problems with GDC/GCC

2017-04-14 Thread DRex via Digitalmars-d-learn
On Friday, 14 April 2017 at 11:51:54 UTC, Nicholas Wilson wrote: On Friday, 14 April 2017 at 11:32:57 UTC, DRex wrote: I have project which involves both C and D code. For reasons that are much too long to explain, I have to use GCC to compile the C code into object files (GDC to compile the

Re: Compilation problems with GDC/GCC

2017-04-14 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 14 April 2017 at 11:32:57 UTC, DRex wrote: I have project which involves both C and D code. For reasons that are much too long to explain, I have to use GCC to compile the C code into object files (GDC to compile the D code into object files) and then ld to link all the object

Compilation problems with GDC/GCC

2017-04-14 Thread DRex via Digitalmars-d-learn
I have project which involves both C and D code. For reasons that are much too long to explain, I have to use GCC to compile the C code into object files (GDC to compile the D code into object files) and then ld to link all the object files together. Now (unless I am missing something) ld

Re: Deduplicating template reflection code

2017-04-14 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 14 Apr 2017 08:55:48 + schrieb Moritz Maxeiner : > > mixin Foo!(API, (MethodType) { > // function dependent code here > }); > foo(); > --- > > Option 2: Code generation using CTFE > > --- > string genFoo(alias API, string justDoIt) > { > import std.array :

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Suliman via Digitalmars-d-learn
On Friday, 14 April 2017 at 10:40:00 UTC, Suliman wrote: I checked all possible combination of dmd and vibed (0.7.30 brunch). No result. Only a little bit another error: Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Suliman via Digitalmars-d-learn
I checked all possible combination of dmd and vibed (0.7.30 brunch). No result. Only a little bit another error: Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Suliman via Digitalmars-d-learn
On Friday, 14 April 2017 at 09:51:55 UTC, Suliman wrote: But I tested it on 2.073.0 too Not 2.073.0 but v2.073.2 I checked v2.073.1 too and he reported that it's buildable with v2.073.1 on his PC. Any ideas?

Re: Can't build simple project. Very strange errors

2017-04-14 Thread Suliman via Digitalmars-d-learn
But I tested it on 2.073.0 too Not 2.073.0 but v2.073.2

Can't build simple project. Very strange errors

2017-04-14 Thread Suliman via Digitalmars-d-learn
I am getting very strange bug on very simple project. Here is sources http://rgho.st/7j5LQLZxb (blue button for downloading). On: dub build I am getting error: Unexpected OPTLINK Termination at EIP=0040F60A EAX=0393 EBX=00438C70 ECX=0EE6 EDX=02CE ESI=0104 EDI=03930468

Re: Deduplicating template reflection code

2017-04-14 Thread Moritz Maxeiner via Digitalmars-d-learn
On Friday, 14 April 2017 at 08:24:00 UTC, Johannes Pfau wrote: I've got this code duplicated in quite some functions: - [...]1 foreach (MethodType; overloads) { // function dependent code here } [...]2

Re: Deduplicating template reflection code

2017-04-14 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 14 April 2017 at 08:24:00 UTC, Johannes Pfau wrote: I've got this code duplicated in quite some functions: - foreach (member; __traits(derivedMembers, API)) { // Guards against private members static if (__traits(compiles, __traits(getMember, API,

Deduplicating template reflection code

2017-04-14 Thread Johannes Pfau via Digitalmars-d-learn
I've got this code duplicated in quite some functions: - foreach (member; __traits(derivedMembers, API)) { // Guards against private members static if (__traits(compiles, __traits(getMember, API, member))) { static if (isSomeFunction!(__traits(getMember,