Re: Socket: The connection was reset

2012-02-10 Thread nrgyzer
]); cs.sendTo(HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nHello World); cs.close(); } On Thu, Feb 9, 2012, at 07:31 PM, Nrgyzer wrote: Hi guys, I wrote the following few lines: private { import std.socket; } void main() { Socket s = new

Re: Socket: The connection was reset

2012-02-10 Thread nrgyzer
: 11\r\n\r\nHello World); cs.close(); } But... how can I make sure that I got all data sent by the client/browser? == Auszug aus DNewbie (r...@myopera.com)'s Artikel nrgyzer, please check the return value of 'receive'. http://dlang.org/phobos/std_socket.html#receive On Fri, Feb 10

IPC: Pipes std.process

2012-02-23 Thread nrgyzer
I'm working on IPC's. I already figured out that the implementation depends on the operation system. Is there any solution to support both - windows posix systems? I'm developing on a win-machine and don't want to re-write my app on linux. As I saw on dlang.org, std.process of Phobos (prerelease)

Nested RegEx

2012-04-21 Thread nrgyzer
Hi guys, I'm trying to use std.regex to parse a string like the following: string myString = preOuter {if condition1} content1 {if condition2} content2 {elseif condition3} content3 {else}any other content{/if}{/if} postOuter; Is there any chance to use std.regex to parse the string above? I

Re: Nested RegEx

2012-04-24 Thread nrgyzer
== Auszug aus Dmitry Olshansky (dmitry.o...@gmail.com)'s Artikel On 21.04.2012 22:46, H. S. Teoh wrote: On Sat, Apr 21, 2012 at 09:41:18PM +0400, Dmitry Olshansky wrote: On 21.04.2012 21:24, nrgyzer wrote: Hi guys, I'm trying to use std.regex to parse a string like the following

Method-call based on template argument

2012-05-09 Thread nrgyzer
I'm trying to do the following: module myModule; int calculate(T)(int a, int b) if(T == add) { return a + b; } int calculate(T)(int a, int b) if(T == subtract) { return a - b; } But when I try to run the following code, I get template myModule.calculate does not match any function

Re: Method-call based on template argument

2012-05-09 Thread nrgyzer
Hm... yes - works. I simply rewrote my method-header and it just works, too... but thanks :)

std.path.buildPath() and string enumeration

2012-05-30 Thread nrgyzer
Hi, I've the following enumeration: enum path : string { log1 = /var/log1, log2 = /var/log2 } Now... when I try to do the following: string subDirectory = example; string newPath = buildPath(path.log1, subDirectory); I get the following errors: Error: template std.path.buildPath does

Re: std.path.buildPath() and string enumeration

2012-05-30 Thread nrgyzer
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel nrgyzer: Is this a bug in std.path.buildPath() or is there anything I'm doing wrong? The signature of buildPath is: immutable(C)[] buildPath(C)(const(C[])[] paths...); But your inputs aren't of the same type. Named enum create

CURL: Save response to string

2012-06-30 Thread Nrgyzer
Hi guys, I know... there's a lib for curl but I'm using an old CURL-binding for D... I've the following problem: I'm sending my login data to a web page and I want store the response of curl_easy_perform() in a string. So I'm using the following few lines to do that: string temp; size_t

Re: Reflection: Get all inherited classes of a base class

2012-12-25 Thread nrgyzer
On Saturday, 22 December 2012 at 22:28:57 UTC, Adam D. Ruppe wrote: On Saturday, 22 December 2012 at 22:14:28 UTC, nrgyzer wrote: is it possible to get a list of all inherited classes from a base class like this: Yes, though it isn't compile time - gotta be runtime. ClassInfo

Error 168 64K Global Types

2013-01-06 Thread nrgyzer
Hi guys, after some hours I successfully compiled wxD without errors. When I try to compile a simple example like the hello example I get the following message: dmd -c -version=wx28 -version=__WXMSW__ -version=ANSI -I..\.. Hello.d dmd -g -of..\..\bin\Hello.exe Hello.obj ..\..\wxd.lib

Rang violation using AA's

2013-02-08 Thread Nrgyzer
Hi guys, I'm updated from DMD 2.060 to 2.061 and I just run into some trouble by using associative arrays. Let's say I've the following few lines: string[string] myValues; ref string getValue(string v) { return myValues[v]; } void main() { getValue(myValue) = myString; } I get a

Re: Rang violation using AA's

2013-02-08 Thread Nrgyzer
On Friday, 8 February 2013 at 19:24:55 UTC, simendsjo wrote: On Friday, 8 February 2013 at 17:16:15 UTC, Nrgyzer wrote: Hi guys, I'm updated from DMD 2.060 to 2.061 and I just run into some trouble by using associative arrays. Let's say I've the following few lines: string[string] myValues

Re: Rang violation using AA's

2013-02-08 Thread Nrgyzer
On Friday, 8 February 2013 at 20:30:00 UTC, Maxim Fomin wrote: On Friday, 8 February 2013 at 20:10:32 UTC, Nrgyzer wrote: void main() { int[string] b; b[hello] = 3; } This works for both versions... but I don't know why using a method with ref-return value doesn't work anymore. Thanks

Socket: Detect connection close

2014-03-23 Thread nrgyzer
Hi guys, I'm experimenting with sockets and having trouble to detect when the remote side closes the connection. Here's my code: // Client: module client; import std.socket; void main() { TcpSocket s = new TcpSocket(); s.connect(new InternetAddress(localhost, 8080));

Re: Socket: Detect connection close

2014-03-24 Thread nrgyzer
On Monday, 24 March 2014 at 05:32:30 UTC, Vladimir Panteleev wrote: On Sunday, 23 March 2014 at 20:12:38 UTC, nrgyzer wrote: Hi guys, I'm experimenting with sockets and having trouble to detect when the remote side closes the connection. Here's my code: // Client: module client; import

How to set JSON_TYPE in 2.0.65

2014-03-31 Thread nrgyzer
Hi guys, I updated my dmd version from 2.0.63 to 2.0.65 and having some trouble with my JSON-definitions. The code below worked in 2.0.63 but not in 2.0.65: JSONValue oJson = JSONValue(); oJson.type = JSON_TYPE.OBJECT; // FAILS oJson.object[myEntry] = JSONValue(); oJson.object[myEntry].type

Re: How to set JSON_TYPE in 2.0.65

2014-04-03 Thread nrgyzer
On Monday, 31 March 2014 at 19:05:11 UTC, Matt Soucy wrote: On 03/31/2014 02:59 PM, nrgyzer wrote: Hi guys, I updated my dmd version from 2.0.63 to 2.0.65 and having some trouble with my JSON-definitions. The code below worked in 2.0.63 but not in 2.0.65: JSONValue oJson = JSONValue

undefined identifier getch()

2010-12-08 Thread Nrgyzer
Hey guys, I'm writing a console based tool for windows. To receive the users input, I try to use getch() but the compiler always says Error: undefined identifier getch. When I use getchar() it compiles successfully, but getchar() doesn't returns after a single input. Is there any equivalent

Re: undefined identifier getch()

2010-12-08 Thread Nrgyzer
Okay, but what function can I use to get the pressed key? kbhit/_kbhit seems to do what I want, but hwo can I use it in D? I always get the error, that kbhit (or similar functions) are not available. import std.stdio; import std.c.stdlib; import std.c.windows.windows; void main(string[] args) {

Re: undefined identifier getch()

2010-12-08 Thread Nrgyzer
Great, thanks :)

function pointers in D2

2010-12-12 Thread Nrgyzer
Hey guys, I've used D1 in the past and D1 seems to check for correct function pointers. In D2 I can pass any function pointer to an function, for example: ... void example(void function(int, int) fp) { ... } ... void callback1(int x, int y) { } void callback2() { } ... example(callback1); //

abstract function templates

2010-12-26 Thread Nrgyzer
Hey guys, I've the following class: abstract class Drawable { public { uint getHeight() { ... } uint getWidth() { ... } abstract { void draw(T = void*)(uint zPos, T obj = null); } } }

Re: abstract function templates

2010-12-26 Thread Nrgyzer
Ah, okay - remove override is enough. Thanks :)

Re: abstract function templates

2010-12-26 Thread Nrgyzer
I just figured out that this doesn't work, when I use a array with super class as base type, for example: Drawable[] textures; Then, I'll get the following error: Error: function draw!(void*).draw non-virtual functions cannot be abstract. I just implemented the draw-function as empty function,

Re: abstract function templates

2010-12-26 Thread Nrgyzer
The sense is that I have different, drawable classes/object - for example a simple texture (not clickable) and a button (clickable). When the user clicks the mouse, the obj-param which is defined by using draw!(T = void*)(uint zPos, T obj = null) will be saved in a template-struct which should

Re: (coff)-Implib lib from dll

2011-01-15 Thread nrgyzer
I just used implib libmysql.lib libmysql.dll /system but it produces the same errors.

Re: (coff)-Implib lib from dll

2011-01-15 Thread Nrgyzer
Thanks, but didn't help to change to implib /system libmysql.lib libmysql.dll - some errors.

Re: (coff)-Implib lib from dll

2011-01-15 Thread Nrgyzer
This solved the problems, thanks - but, when the line mysql = mysql_init(null); produces an access violation.

Threads fibers

2011-01-30 Thread Nrgyzer
Hey guys, I already posted a thread in the wrong section (digitalmars.D instead of digitalmars.D.learn) - sorry for that. I'm looking for a solution to suspend/ interrupt threads which are sleeping. In the last few minutes I figured out some things I didn't understand exactly. I tested thread

Re: Threads fibers

2011-01-30 Thread Nrgyzer
Nrgyzer nrgy...@gmail.com wrote: The result is: true which means that testInstance of type a is null - but I already created a instance and if I write writeln(testInstance is null); after Thread.yield(); in the main, it says false which means testInstance is a valid instance

Associative array and ranges

2011-02-02 Thread Nrgyzer
Hey guys, I have an associative array like this: T[hash_t] myArray; (T means the template type). Is there any chance to cast/convert this array to an indexed array or is it possible to iterate over specific indices? I know that there is something like next() for the foreach-statement but when

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel Nrgyzer: Is there any chance to cast/convert this array to an indexed array or is it possible to iterate over specific indices? I know that there is something like next() for the foreach-statement but when the array contains

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 09:35:44 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel Nrgyzer: Is there any chance to cast/convert this array to an indexed array

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 10:41:16 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 09:35:44 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus Stanislav Blinov (bli...@loniir.ru)'s Artikel 03.02.2011 19:34, Nrgyzer пишет: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel This only works if you rarely remove elements (removal in an array is an O(n) operation). -Steve I already thought about using

foreach over string enum

2011-02-10 Thread Nrgyzer
Hey guys, I'm trying to iterate over an enumeration which contains strings like the this: enum FileName : string { file1 = file1.ext, file2 = file2.ext } I already found this article: http://lists.puremagic.com/pipermail/ digitalmars-d/2007-July/021920.html but it's an enum which contains

Re: foreach over string enum

2011-02-10 Thread Nrgyzer
== Auszug aus Jesse Phillips (jessekphillip...@gmail.com)'s Artikel Nrgyzer Wrote: Hey guys, I'm trying to iterate over an enumeration which contains strings like the this: enum FileName : string { file1 = file1.ext, file2 = file2.ext } I already found this article: http

Read non-UTF8 file

2011-02-13 Thread Nrgyzer
Hey guys, I've the following source: module filereader; import std.file; import std.stdio : writeln; void main(string[] args) { File f = new File(myFile.ext, FileMode.In); while(!f.eof()) { writeln(convertToUTF8(f.readLine())); } f.close(); }

Re: Read non-UTF8 file

2011-02-19 Thread Nrgyzer
== Auszug aus Stewart Gordon (smjg_1...@yahoo.com)'s Artikel On 13/02/2011 21:49, Nrgyzer wrote: snip It compiles and works as long as the returned char-array/string of f.readLine() doesn't contain non-UTF8 character(s). If it contains such chars, writeln() doesn't write anything

Re: Read non-UTF8 file

2011-02-20 Thread Nrgyzer
== Auszug aus spir (denis.s...@gmail.com)'s Artikel On 02/19/2011 02:42 PM, Nrgyzer wrote: == Auszug aus Stewart Gordon (smjg_1...@yahoo.com)'s Artikel On 13/02/2011 21:49, Nrgyzer wrote: snip It compiles and works as long as the returned char-array/string of f.readLine() doesn't

Re: OpenGL in D2

2011-02-21 Thread Nrgyzer
== Auszug aus Siqu (u...@example.net)'s Artikel Hi, I'm trying to figure out how I could get a simple OpenGL/GLUT program working in DMD2. As an attachment, I've added a C version of what I'd like to do. I'd compile the C version using: gcc simple.c -lglut -lGLU -o simple I've found a few

Re: Read non-UTF8 file

2011-02-22 Thread Nrgyzer
== Auszug aus Stewart Gordon (smjg_1...@yahoo.com)'s Artikel What compiler version/platform are you using? I had to fix some errors before it would compile on mine (1.066/2.051 Windows). On 19/02/2011 13:42, Nrgyzer wrote: snip Now... and with writefln(%s, cast(ubyte[]) convertToUTF8

Re: OpenGL in D2

2011-02-23 Thread Nrgyzer
== Auszug aus Sequ (u...@example.net)'s Artikel Quoted from Nrgyzer: On windows you've to create a folder called lib before you run the command above - I currently can't say it exactly if it's needed on linux, too. I did need to create a 'lib' directory before running 'make - flinux.mak DC

Read file/stream

2011-03-11 Thread nrgyzer
I'm trying to read a png file and I'm having some trouble with the chunk-size. Each chunk of a png file begins with a 4 byte (unsigned) integer. When I read this 4 byte integer (uint) I get an absolutely incorrect length. My code currently looks like: void main(string args) { File f = new

Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-26 Thread nrgyzer
Hey guys, I got Assertion failure: '!vthis-csym' on line 703 in file 'glue.c' after I add LinkList!(uint) myList; to my source file. I figured out that the same bug was already reported on http://lists.puremagic.com/ pipermail/digitalmars-d-bugs/2010-October/019237.html Ticket 4129 describes a

Re: Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-27 Thread nrgyzer
== Auszug aus David Nadlinger (s...@klickverbot.at)'s Artikel On 3/26/11 11:08 PM, bearophile wrote: I suggest to copy your code, and then keep removing lines from your copy, making sure it keep showing the same compiler error. In some time you will probably be able to produce a small program,

Re: Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-27 Thread nrgyzer
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel nrgyzer: In my tests, that code above doesn't produces the assertion failure, but my original source code looks very similar. You may have to start over then. I suggest to duplicate the whole code, and then start on the copied

toHash() and Interfaces

2011-05-05 Thread Nrgyzer
Hey guys, I'm trying to call toHash() in a class which receives an interface class as input param. But I always get Error: no property 'toHash' for type My code looks like: module iFBlock; private { import std.stream; } interface IFBlock { public { void write(Stream); } }

Re: toHash() and Interfaces

2011-05-06 Thread Nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 05 May 2011 17:03:51 -0400, Nrgyzer nrgy...@gmail.com wrote: Hey guys, I'm trying to call toHash() in a class which receives an interface class as input param. But I always get Error: no property 'toHash

Re: Interface/abstract constructors

2011-05-16 Thread nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Mon, 16 May 2011 15:32:43 -0400, useo unkn...@unknown.com wrote: Hey guys, is there any chance to create an abstract constructor like: abstract class ABC { abstract this(); } DMD always says ...this

Re: Interface/abstract constructors

2011-05-16 Thread nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Mon, 16 May 2011 16:12:05 -0400, nrgyzer nrgy...@gmail.com wrote: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Mon, 16 May 2011 15:32:43 -0400, useo unkn...@unknown.com wrote: Hey guys

Int within ranges

2011-06-13 Thread nrgyzer
Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] = 1000; myArray[20] = 2000; myArray[30] = 3000; myArray[40] = 4000; myArray[50] = 5000; int[] newArray = myArray[= 20 .. = 40]; // not able to do this

Re: Int within ranges

2011-06-13 Thread nrgyzer
On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10] = 1000; myArray[20] = 2000; myArray[30] = 3000; myArray[40] = 4000

Re: Int within ranges

2011-06-13 Thread nrgyzer
On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi there, is there any possibility to get a sliced array from another array between two ranges like: int[uint] myArray; myArray[10

Re: Int within ranges

2011-06-13 Thread nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Mon, 13 Jun 2011 15:44:01 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer nrgy...@gmail.com wrote: On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer nrgy...@gmail.com wrote: Hi

Runtime evaluation

2011-07-07 Thread nrgyzer
Hi guys, I'm trying to read a string from a text file which contains a value of an enumeration like: enum MyEnum : string { Entry_1 = abc, Entry_2 = def, Entry_3 = ghi, } Stream s = new File(myFile.ext, FileMode.In); uint len; s.read(len); string entry = cast(string)

Re: Runtime evaluation

2011-07-09 Thread nrgyzer
== Auszug aus Mafi (m...@example.org)'s Artikel Am 07.07.2011 23:23, schrieb nrgyzer: Hi guys, I'm trying to read a string from a text file which contains a value of an enumeration like: enum MyEnum : string { Entry_1 = abc, Entry_2 = def, Entry_3 = ghi, } Stream

Sending messages using socket

2011-07-24 Thread nrgyzer
Hi guys, I'm trying to work with sockets but I've some trouble with them. I implemented a really simple Socket which should simply send a text message after accepting the request. My code is the following: module server; import std.socket; void main() { TcpSocket server = new

Re: Sending messages using socket

2011-07-24 Thread nrgyzer
== Auszug aus Adam Ruppe (destructiona...@gmail.com)'s Artikel Browsers speak HTTP, which is a higher level protocol than plain sockets. If you connect to your app with a simpler program, like nc, you'll probably see the message. If you want to serve web pages, consider one of these options:

Re: Sending messages using socket

2011-07-25 Thread nrgyzer
== Auszug aus Adam Ruppe (destructiona...@gmail.com)'s Artikel Browsers speak HTTP, which is a higher level protocol than plain sockets. If you connect to your app with a simpler program, like nc, you'll probably see the message. If you want to serve web pages, consider one of these options:

exe-Icon

2011-08-01 Thread Nrgyzer
Hi guys, the most applications using there own icons for the exe-file. I'm currently using external tools to set my own icon for the exe, but is there any chance to automatically set the icon using the dmd compiler?

Re: exe-Icon

2011-08-01 Thread Nrgyzer
as an argument to dmd. On Mon, Aug 1, 2011 at 10:27 AM, Nrgyzer nrgy...@gmail.com wrote: Hi guys, the most applications using there own icons for the exe-file. I'm currently using external tools to set my own icon for the exe, but is there any chance to automatically set the icon using

Read property using std.stream.Stream.read

2011-08-13 Thread nrgyzer
Hi guys, I'm trying to read a property of a class like: class MyClass { private ubyte pToRead; @property ubyte toRead() { return pToRead; } } ... File f = new File(...); MyClass c = new MyClass(); f.read(c.toRead); ... but when I compile my code, I always get: executable.d(389):

Re: Read property using std.stream.Stream.read

2011-08-13 Thread nrgyzer
== Auszug aus nrgyzer (nrgy...@gmail.com)'s Artikel Hi guys, I'm trying to read a property of a class like: class MyClass { private ubyte pToRead; @property ubyte toRead() { return pToRead; } } ... File f = new File(...); MyClass c = new MyClass(); f.read(c.toRead); ... but when

Insert array into an AA

2011-08-16 Thread nrgyzer
Hi everyone, I've the following: private static ubyte[][2][hash_t] classInstances; this() { classInstances[toHash()] = new ubyte[2]; // does not work } I want insert every class instance into the hashmap. Every class instance should be contained in the map after the constructor was

Re: Insert array into an AA

2011-08-18 Thread nrgyzer
== Auszug aus Robert Clipsham (rob...@octarineparrot.com)'s Artikel On 16/08/2011 20:17, nrgyzer wrote: Hi everyone, I've the following: private static ubyte[][2][hash_t] classInstances; this() { classInstances[toHash()] = new ubyte[2]; // does not work } I want

Re: Insert array into an AA

2011-08-19 Thread nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 18 Aug 2011 06:47:32 -0400, nrgyzer nrgy...@gmail.com wrote: == Auszug aus Robert Clipsham (rob...@octarineparrot.com)'s Artikel On 16/08/2011 20:17, nrgyzer wrote: Hi everyone, I've the following

shared members and castings

2011-11-12 Thread nrgyzer
Hi guys, is there any way to use shared members without casting them? Fox example: class Example { private shared HashSet!(string) ex; ... this() { ex = cast(shared) new HashSet!(string)(); } void write() { foreach (ref c; cast(HashSet!(string)) ex) {

Internal error: ..\ztc\cgcs.c 352

2011-11-22 Thread Nrgyzer
Hi guys, I get an internal error in \ztc\cgcs.c 352 when I try to do the following: HashMap!(uint, float[2]) example; void main() { example = new HashMap!(uint, float[2])(); example.set(0, [10.f, 20.f]); example.set(10, [100.f, 200.f]); foreach (ref c; example.keys)

std.stream.Stream.read([...]) matches both

2012-01-16 Thread Nrgyzer
Hi, I used Stream.read(out float) to read bytes of my stream. It worked for 2.056, but when I try to compile my code using 2.057 I get the following message: ((shared(float))) matches both: std.stream.Stream.read(out float x) and: std.stream.Stream.read(out real x) Because of

Export values (enum, int, char[]...) for DLL

2010-05-04 Thread Nrgyzer
Hello everybody, I'm trying to create a (very) simple DLL by using D. Now I want export values - is there any way do this... for example: Example: mydll.d: export int i; mydll2.d: export int i = 99; dll.d: // Copied from http://www.digitalmars.com/d/2.0/dll.html test.d: import std.stdio;

Re: Export values (enum, int, char[]...) for DLL

2010-05-05 Thread Nrgyzer
Ary Borenszweig Wrote: Nrgyzer wrote: Hello everybody, I'm trying to create a (very) simple DLL by using D. Now I want export values - is there any way do this... for example: Example: mydll.d: export int i; mydll2.d: export int i = 99; dll.d: // Copied from

Re: Export values (enum, int, char[]...) for DLL

2010-05-06 Thread Nrgyzer
torhu Wrote: On 04.05.2010 21:46, Nrgyzer wrote: Hello everybody, I'm trying to create a (very) simple DLL by using D. Now I want export values - is there any way do this... Off the top of my head, I think it goes like this: To export from a DLL: export int i = 7; To export

Re: Export values (enum, int, char[]...) for DLL

2010-05-07 Thread Nrgyzer
torhu Wrote: On 06.05.2010 16:06, Nrgyzer wrote: Thanks, but doesn't work :( My files contain: mydll.d: module mydll; export extern int i; mydll2.d: module mydll; export int i = 7; test.d: import mydll; import std.stdio; void main() { writefln(i

Re: Export values (enum, int, char[]...) for DLL

2010-05-13 Thread Nrgyzer
Nrgyzer Wrote: torhu Wrote: On 06.05.2010 16:06, Nrgyzer wrote: Thanks, but doesn't work :( My files contain: mydll.d: module mydll; export extern int i; mydll2.d: module mydll; export int i = 7; test.d: import mydll; import std.stdio

Array over exported dll-class

2010-05-22 Thread Nrgyzer
Hello everyone, I'm trying to create a dll file with a class which will be exported. When I import the dll into another file and want create an array over this exported class, I always get Error: Access Violation. For example: mydll2.d: export class exampleClass { export static

opIndex() overloading for multiple arrays

2010-09-11 Thread Nrgyzer
Hey guys, is it possible to overload opIndex() with a multiple array, for example: class Example { ... char[] opIndex(uint index1, uint index2) { return my text to return; } ... } Example t = new Example(); writefln(t[0][10]); Looking forward to hearing from anyone :)

Re: opIndex() overloading for multiple arrays

2010-09-11 Thread Nrgyzer
Thanks for reply... exactly, what I need.

Append wchar enumeration to string

2010-11-21 Thread Nrgyzer
Hello guys, I have an enumeration which contains symbols of different currencies like the following: enum CURRENCY : wchar { DOLLAR = '$', EURO = '�', YEN = ... } When I try to append it to a string like char[] myString = Currency: ~ CURRENCY.DOLLAR I get the

Re: Append wchar enumeration to string

2010-11-21 Thread Nrgyzer
But for enums I can't use char[] as basetype and when I use cast(dchar) or cast(wchar) I also get Error: incompatible types for

Re: Append wchar enumeration to string

2010-11-21 Thread Nrgyzer
I solved the problem by using toUTF8 from std.utf but I think it's a dirty solution because I have to cast wchar to wchar[] because a simple toUTF8(CURRENCY.DOLLAR) matches wchar[] and dchar[] signatures.

Base64 - Encoding and decoding

2010-11-27 Thread Nrgyzer
Hey guys, I want encode and decode binary files like images, documents and similar file types to use it in an binary xml. For those I created a simple command line tool which encode or decode an file. The encoding of files will be processed by these lines: ... ubyte[] buffer; buffer.length =

goto skips declaration of variable

2014-08-18 Thread nrgyzer via Digitalmars-d-learn
Hi all, I've the following code snipped: import std.bigint; void main(string[] args) { BigInt i = 12345; if (args.length 1) { goto Exit; } i = BigInt(67890); Exit: return; } When I try to compile this sample

Re: goto skips declaration of variable

2014-08-19 Thread nrgyzer via Digitalmars-d-learn
On Monday, 18 August 2014 at 17:47:21 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 18 Aug 2014 13:51:12 + nrgyzer via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: When I try to compile this sample application I'm getting the following error: sample.d(7): Error

Re: goto skips declaration of variable

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 20:33:00 UTC, monarch_dodra wrote: On Monday, 18 August 2014 at 13:51:14 UTC, nrgyzer wrote: Hi all, I've the following code snipped: import std.bigint; void main(string[] args) { BigInt i = 12345; if (args.length 1

Re: goto skips declaration of variable

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
On Thursday, 21 August 2014 at 17:39:16 UTC, Ali Çehreli wrote: On 08/21/2014 04:12 AM, nrgyzer wrote: I'm using the goto-command to exit my function if an error (not necessarily an exception) occured. Sorry to repeat myself but if an exception occurs in code before the goto, the exit code

Value of floating in JSONValue

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
Hi everyone, I'm facing a problem with the JSON functions. I've to communicate with another PC using JSON. Here's a simple snipped which shows my problem: import std.json; import std.stdio; void main() { double d = 1.23456789; JSONValue j = d; sendToRemote(toJSON(j)); }

Re: Value of floating in JSONValue

2014-08-22 Thread nrgyzer via Digitalmars-d-learn
On Thursday, 21 August 2014 at 23:29:56 UTC, Idan Arye wrote: On Thursday, 21 August 2014 at 23:05:48 UTC, Ali Çehreli wrote: I don't think it is a concern as JSON does not encode types. It is up to the receiver how to interpret the data. Here is the output of the program above:

Using TreeSet and __gshared values

2014-09-03 Thread nrgyzer via Digitalmars-d-learn
Hi guys, I'm having some trouble using the treeset implementation of Steven (dcollections) in conjunction with __gshared. When I do the following: class Entry { int value; this(int v) { value = v; } int opCmp(Object o) {

Using __traits to find functions in sub-modules

2014-10-16 Thread nrgyzer via Digitalmars-d-learn
Hi, I'm using structs to describe my functions: struct example { string name; uint someValue; } module mod.example1; @example(example1, 1) void myFunction() { // do something } module mod.example2; @example(example2, 2) void myFunction() { // do something } I'm using the struct to

Re: Using __traits to find functions in sub-modules

2014-10-17 Thread nrgyzer via Digitalmars-d-learn
On Thursday, 16 October 2014 at 19:19:21 UTC, John Colvin wrote: On Thursday, 16 October 2014 at 18:39:50 UTC, nrgyzer wrote: Hi, I'm using structs to describe my functions: struct example { string name; uint someValue; } module mod.example1; @example(example1, 1) void myFunction

Error: Undefined identifier when moving import to another module

2014-10-19 Thread nrgyzer via Digitalmars-d-learn
Hi guys, when I do the following: module myMain; import example; import std.traits; import my.static.library.binding; static this() { foreach ( m; __traits(allMembers, example) ) { static if ( isCallable!(mixing(m) ) { // ... do something here } } } void

Re: Error: Undefined identifier when moving import to another module

2014-10-19 Thread nrgyzer via Digitalmars-d-learn
On Sunday, 19 October 2014 at 14:48:18 UTC, monarch_dodra wrote: On Sunday, 19 October 2014 at 09:39:05 UTC, nrgyzer wrote: Hi guys, when I do the following: static if ( isCallable!(mixing(m) ) mixing ? void main() { /* do something here */ } What exactly are you doing here

Re: Error: Undefined identifier when moving import to another module

2014-10-19 Thread nrgyzer via Digitalmars-d-learn
On Sunday, 19 October 2014 at 17:14:14 UTC, monarch_dodra wrote: On Sunday, 19 October 2014 at 16:09:41 UTC, nrgyzer wrote: mixing should be replaced with mixin: static if ( isCallable!(mixin(m) ) My main is empty in both cases. So nothing done in my main (currently). Posting full code

Re: Error: Undefined identifier when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
On Sunday, 19 October 2014 at 22:22:05 UTC, Joakim wrote: On Sunday, 19 October 2014 at 09:39:05 UTC, nrgyzer wrote: Hi guys, when I do the following: module myMain; import example; import std.traits; import my.static.library.binding; static this() { foreach ( m; __traits(allMembers

Re: Error: Undefined identifier when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
On Monday, 20 October 2014 at 16:05:14 UTC, nrgyzer wrote: On Sunday, 19 October 2014 at 22:22:05 UTC, Joakim wrote: On Sunday, 19 October 2014 at 09:39:05 UTC, nrgyzer wrote: Hi guys, when I do the following: module myMain; import example; import std.traits; import

Re: Error: Undefined identifier when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
This solved the problem for the first time, BUT - I don't know if it's a bug or a feature - I ran into another problem. I'm having the following few lines: module example; private { string[string] myPrivateArray; } static this() { foreach ( m; __traits(allMembers, example) ) {

Re: Error: Undefined identifier when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
On Monday, 20 October 2014 at 17:37:34 UTC, nrgyzer wrote: This solved the problem for the first time, BUT - I don't know if it's a bug or a feature - I ran into another problem. I'm having the following few lines: module example; private { string[string] myPrivateArray; } static

  1   2   >