Mistake of opening of a file having a name in cp1251.

2015-04-03 Thread MGW via Digitalmars-d-learn
Greetings to all! I work on Windows with cp1251 and I have a mistake in the program: import std.stdio; int main (string [] args) { string nameFile = `«Ёлки с объектами №876».txt`; File f = File (nameFile, w); f.writeln (Greetings!); return 0; } This mistake of a kind:

Re: Mistake of opening of a file having a name in cp1251.

2015-04-03 Thread Danny via Digitalmars-d-learn
According to the documentation https://msdn.microsoft.com/de-de/library/yeby3zcb.aspx, _wfopen already takes a wide-character string, not an ANSI string. So return _wfopen(name.tempCStringW(), mode.tempCStringW()); would be the correct way. All these weird ansi versions are Windows

linking C library with D, creating a OpenVG D port

2015-04-03 Thread ddos via Digitalmars-d-learn
hi! i'm trying to run OpenVG examples in D. So far i have compiled ShivaVG (an implementation of OpenVG standard) in C++ and created a shared library. Now i'd like to link my OpenVG.lib with a D program. (the library was compiled with msvc2013x86, i'd like to avoid switching compiler) to

Re: Mistake of opening of a file having a name in cp1251.

2015-04-03 Thread MGW via Digitalmars-d-learn
The decision, which I have applied using function fromUtf8toAnsiW() already works correctly. I use dmd 2.067.0

Re: linking C library with D, creating a OpenVG D port

2015-04-03 Thread ddos via Digitalmars-d-learn
progress ... i think in some forum posts i've read 64bit dmd uses a differnt linker which supports coff atleast i can now link my app in 64bit mode without errors dmd -m64 source/app.d OpenVG.lib also an exported test function prints to stdout, so my problem is solved for x64 :) if anyone

Re: linking C library with D, creating a OpenVG D port

2015-04-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 4/04/2015 1:00 a.m., ddos wrote: progress ... i think in some forum posts i've read 64bit dmd uses a differnt linker which supports coff atleast i can now link my app in 64bit mode without errors dmd -m64 source/app.d OpenVG.lib also an exported test function prints to stdout, so my problem

Re: Mistake of opening of a file having a name in cp1251.

2015-04-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/3/15 2:26 AM, MGW wrote: Greetings to all! I work on Windows with cp1251 and I have a mistake in the program: import std.stdio; int main (string [] args) { string nameFile = `«Ёлки с объектами №876».txt`; File f = File (nameFile, w); f.writeln (Greetings!); return 0; }

Placing variable/array in a particular section

2015-04-03 Thread Jens Bauer via Digitalmars-d-learn
Today I finally succeeded in building my first Hello World D program (after fixing the endian problem). Is there a way of setting the target section for a variable or an array ? Eg. the equivalent way of doing this using gcc is: __attribute__((section(.isr_vector))) VectorFunc

Re: D1 operator overloading in D2

2015-04-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/30/15 11:25 AM, Steven Schveighoffer wrote: I'll put in a doc PR to reference the D1 documentation. https://github.com/D-Programming-Language/dlang.org/pull/953 -Steve

C++ to D - recursion with std.variant

2015-04-03 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, Is it possible to write on D recursion using std.variant? - #include boost/variant.hpp #include iostream struct Nil {}; auto nil = Nil{}; template typename T struct Cons; template typename T using List = boost::variantNil, boost::recursive_wrapperConsT; template typename T struct

Issue with free() for linked list implementation

2015-04-03 Thread Kitt via Digitalmars-d-learn
Hello. I’m trying to write my own version of a list that doesn’t rely on the garbage collector. I’m working on a very bare bones implementation using malloc and free, but I’m running into an exception when I attempt to call free. Here is a very minimal code sample to illustrate the issue: //

Re: Issue with free() for linked list implementation

2015-04-03 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 3 April 2015 at 22:08:52 UTC, Kitt wrote: Thanks for the help =) I guess I've been in C# land at work for way too long now, my low level C skills are evaporating! I've written a straight forward linked list implementation here:

Re: Issue with free() for linked list implementation

2015-04-03 Thread Namespace via Digitalmars-d-learn
On Friday, 3 April 2015 at 22:02:13 UTC, Kitt wrote: Hello. I’m trying to write my own version of a list that doesn’t rely on the garbage collector. I’m working on a very bare bones implementation using malloc and free, but I’m running into an exception when I attempt to call free. Here is a

Re: Issue with free() for linked list implementation

2015-04-03 Thread Kitt via Digitalmars-d-learn
On Friday, 3 April 2015 at 22:06:06 UTC, Namespace wrote: On Friday, 3 April 2015 at 22:02:13 UTC, Kitt wrote: Hello. I’m trying to write my own version of a list that doesn’t rely on the garbage collector. I’m working on a very bare bones implementation using malloc and free, but I’m running

Re: Issue with free() for linked list implementation

2015-04-03 Thread Namespace via Digitalmars-d-learn
Wow, I can't even begin to explain how red my cheeks are right now. You're completely right; I have no idea what my head was thinking. Sure enough, call malloc with the correct type, and the error goes away =P Thanks for the help =) I guess I've been in C# land at work for way too long now,

Re: Issue with free() for linked list implementation

2015-04-03 Thread Namespace via Digitalmars-d-learn
On Friday, 3 April 2015 at 22:38:00 UTC, Gary Willoughby wrote: On Friday, 3 April 2015 at 22:08:52 UTC, Kitt wrote: Thanks for the help =) I guess I've been in C# land at work for way too long now, my low level C skills are evaporating! I've written a straight forward linked list

Re: lambda code

2015-04-03 Thread Vlad Levenfeld via Digitalmars-d-learn
On Thursday, 2 April 2015 at 19:27:21 UTC, John Colvin wrote: On Wednesday, 1 April 2015 at 23:29:00 UTC, Vlad Levenfeld wrote: On Tuesday, 31 March 2015 at 13:25:47 UTC, John Colvin wrote: On Tuesday, 31 March 2015 at 12:49:36 UTC, Vlad Levenfeld wrote: Is there any way (or could there be any

Re: Placing variable/array in a particular section

2015-04-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 4/04/2015 3:08 a.m., Jens Bauer wrote: On Friday, 3 April 2015 at 13:58:21 UTC, Jens Bauer wrote: On Friday, 3 April 2015 at 13:37:50 UTC, Rikki Cattermole wrote: On 4/04/2015 2:12 a.m., Jens Bauer wrote: Is there a way of setting the target section for a variable or an array ?

Re: Placing variable/array in a particular section

2015-04-03 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 3 April 2015 at 13:58:21 UTC, Jens Bauer wrote: On Friday, 3 April 2015 at 13:37:50 UTC, Rikki Cattermole wrote: On 4/04/2015 2:12 a.m., Jens Bauer wrote: Is there a way of setting the target section for a variable or an array ? Supposedly gdc supports it. [0]

Re: Placing variable/array in a particular section

2015-04-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 4/04/2015 2:12 a.m., Jens Bauer wrote: Today I finally succeeded in building my first Hello World D program (after fixing the endian problem). Is there a way of setting the target section for a variable or an array ? Eg. the equivalent way of doing this using gcc is:

Re: Placing variable/array in a particular section

2015-04-03 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 3 April 2015 at 13:37:50 UTC, Rikki Cattermole wrote: On 4/04/2015 2:12 a.m., Jens Bauer wrote: Is there a way of setting the target section for a variable or an array ? Supposedly gdc supports it. [0] http://wiki.dlang.org/GDC/Using_GDC Extensions-Attributes [1]

Re: linking C library with D, creating a OpenVG D port

2015-04-03 Thread ddos via Digitalmars-d-learn
thanks Rikki! also if anyone is interested in OpenVG i have now a running demo in D based on ShivaVG and derelict GLFW3, it's not beautiful but it works :D http://imgur.com/ZH0kD0q i'm pretty impressed how painless the compiling and interfacing to C was actually :) +1 for D