Re: Cannot compile program with DMD built from source

2016-03-09 Thread Minas Mina via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 16:13:38 UTC, Minas Mina wrote: Hello, I have followed the instructions here (http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to install DMD, druntime and phobos from source. My platform is Ubuntu 15.10 x64. This is the error I get: http://pastebin.com

Cannot compile program with DMD built from source

2016-03-09 Thread Minas Mina via Digitalmars-d-learn
Hello, I have followed the instructions here (http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to install DMD, druntime and phobos from source. My platform is Ubuntu 15.10 x64. This is the error I get: http://pastebin.com/kWCv0ymn

Re: Application with WinMain does not start

2016-03-05 Thread Minas Mina via Digitalmars-d-learn
On Saturday, 5 March 2016 at 14:08:28 UTC, Mike Parker wrote: On Saturday, 5 March 2016 at 14:01:11 UTC, Mike Parker wrote: If you use WinMain, you do not need that flag. Actually, I need to amend that. It isn't needed with WinMain when using the Microsoft linker, but it is when using OPTLIN

Application with WinMain does not start

2016-03-05 Thread Minas Mina via Digitalmars-d-learn
I added a WinMain function to my application because I don't want it to open a console when running on windows. But now it doesn't even start... extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { bool b = true; while

Re: efficient and safe way to iterate on associative array?

2016-03-04 Thread Minas Mina via Digitalmars-d-learn
On Friday, 4 March 2016 at 13:53:22 UTC, aki wrote: Is it okay to modify associative array while iterating it? import std.stdio; void main() { string[string] hash = [ "k1":"v1", "k2":"v2" ]; auto r = hash.byKeyValue(); while(!r.empty) { auto key = r.front

Trouble installing DCD on Windows

2016-02-27 Thread Minas Mina via Digitalmars-d-learn
Hello. I'm trying to install DCD on windows 8.1 using DUB but I get an error. When executing "dub build --build=release --config=client" I get the following error: => Root package dcd contains reference to invalid package libdparse >=0.5.0 <0.6.0 <=

Re: std.experimental.logger.Logger writeLogMsg is @safe?

2016-02-22 Thread Minas Mina via Digitalmars-d-learn
On Monday, 22 February 2016 at 23:03:38 UTC, Jonathan M Davis wrote: On Monday, February 22, 2016 22:22:01 Minas Mina via Digitalmars-d-learn wrote: [...] Short answer: [...] Great, thanks.

std.experimental.logger.Logger writeLogMsg is @safe?

2016-02-22 Thread Minas Mina via Digitalmars-d-learn
I'm trying to inherit from Logger, and I my custom logger to print to stdout using writeln(). But I can't because writeLogMsg is @safe, whereas writeln() is @system. Why is writeLogMsg @safe? This is too restrictive.

Re: is increment on shared ulong atomic operation?

2016-02-07 Thread Minas Mina via Digitalmars-d-learn
On Sunday, 7 February 2016 at 19:43:23 UTC, rsw0x wrote: On Sunday, 7 February 2016 at 19:39:27 UTC, rsw0x wrote: On Sunday, 7 February 2016 at 19:27:19 UTC, Charles Hixson wrote: If I define a shared ulong variable, is increment an atomic operation? E.g. shared ulong t; ... t++; It seems

Re: Proper Use of Assert and Enforce

2016-02-05 Thread Minas Mina via Digitalmars-d-learn
On Wednesday, 14 March 2012 at 05:44:24 UTC, Chris Pons wrote: I'm new, and trying to incorporate assert and enforce into my program properly. My question revolves around, the fact that assert is only evaluated when using the debug switch. I read that assert throws a more serious exception th

Re: Most performant way of converting int to string

2015-12-23 Thread Minas Mina via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 22:29:31 UTC, Andrew Chapman wrote: On Wednesday, 23 December 2015 at 11:46:37 UTC, Jakob Ovrum wrote: On Wednesday, 23 December 2015 at 11:21:32 UTC, Jakob Ovrum wrote: Dynamic memory allocation is expensive. If the string is short-lived, allocate it on the st

Re: Using executeShell in multiple thread causes access violation error

2015-07-17 Thread Minas Mina via Digitalmars-d-learn
bump

Using executeShell in multiple thread causes access violation error

2015-07-13 Thread Minas Mina via Digitalmars-d-learn
I have written a script that visits all directories in the current directory and executes a command. In my case, "git pull". When running the script serially, everything is fine. All git repositories are pulled. But I'd like to pull multiple repositories in parallel to speed things up. So I

Re: How do I use dub?

2014-10-24 Thread Minas Mina via Digitalmars-d-learn
Oh and another thing: The program compiles right now but I can't execute it because for some reason: Failed to create a child process. Cannot run program "/home/minas/Projects/eclipse_workspace/DTest/dtest" (in directory "/home/minas/Projects/eclipse_workspace/DTest"

How do I use dub?

2014-10-24 Thread Minas Mina via Digitalmars-d-learn
relict-sfml2": "~2.1" }, "versions-x86_64": ["UseAmd64Impl"], "lflags": ["-I/home/minas/.dub/packages/derelict-sfml2-2.1/lib", "-LDerelictSFML2"] } The way I specified the library seems very ugly to me. Essentially it's a full path... How can I tell dub to use it by locating it automatically from its local repository?

Re: Global const variables

2014-10-21 Thread Minas Mina via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 08:02:52 UTC, bearophile wrote: Currently this code gets rejected: const int[] a = [1]; void main() pure { auto y = a[0]; } test2.d(3,14): Error: pure function 'D main' cannot access mutable static data 'a' test2.d(3,14): Error: pure function 'D main' cannot

Re: and/or/not/xor operators

2013-05-31 Thread Minas Mina
On Thursday, 30 May 2013 at 16:48:33 UTC, bearophile wrote: Shriramana Sharma: Hello. I have always loved the readability of C++'s and/or/not/xor word-like logical operators but It doesn't seem to be available in D. and/or/not are less visually noisy, they look better than the ugly &&/||/!

Re: Deallocate array?

2013-05-08 Thread Minas Mina
On Tuesday, 7 May 2013 at 23:09:29 UTC, Matic Kukovec wrote: Hi I'm running Windows Vista 64 with dmd 2.062. I have a simple program: import std.stdio, core.memory, std.cstream; void main() { string[] temp_array; for(int i=0;i<500;i++) { ++temp_arra

Re: immutable string

2013-04-27 Thread Minas Mina
On Saturday, 27 April 2013 at 18:14:11 UTC, Michael wrote: According to http://dlang.org/const3.html The simplest immutable declarations use it as a storage class. It can be used to declare manifest constants. So, immutable string s = "..."; should be a manifest constant. If it is a constant

Re: Direlect3 with Mono-D

2013-04-22 Thread Minas Mina
If you aren't comfortable with either C++ or D I would suggest to do the tutorials with C++, as there are no OpenGL tutorials for D. Don't try to learn two things at the same time.

Re: Direlect3 with Mono-D

2013-04-21 Thread Minas Mina
On Saturday, 20 April 2013 at 15:49:47 UTC, Dementor561 wrote: I have all the needed files to use Direlect3, and I have Mono-D installed on Xamarin, I was wondering how I could put it all together in a project. 1) Do you use windows or linux? 2) Have you built derelict3? 3) If you are using li

Re: operator +=

2013-04-08 Thread Minas Mina
On Monday, 8 April 2013 at 12:37:34 UTC, Simen Kjaeraas wrote: On 2013-04-08, 14:23, Minas Mina wrote: How can I define operator += for a struct? http://dlang.org/operatoroverloading.html In short: struct S { auto opOpAssign( string op : "+" )( S other ) { // Do

operator +=

2013-04-08 Thread Minas Mina
How can I define operator += for a struct?

Re: Question about auto ref

2013-03-27 Thread Minas Mina
auto in? in ref?

Re: Question about auto ref

2013-03-26 Thread Minas Mina
Why is "const ref" not a good choice?

Re: Segfault in "_d_dynamic_cast ()"

2013-01-25 Thread Minas Mina
On Friday, 25 January 2013 at 16:19:15 UTC, Maxim Fomin wrote: On Friday, 25 January 2013 at 15:15:32 UTC, Minas Mina wrote: I found what the root of all evil was - The GC. After disabling it, the program runs fine. Perhaps you was working with C code, GC + legacy code sometimes lead to

Re: Segfault in "_d_dynamic_cast ()"

2013-01-25 Thread Minas Mina
Maybe. I am re-writing the code in C++ to see, and also to compare the performance.

Re: Segfault in "_d_dynamic_cast ()"

2013-01-25 Thread Minas Mina
I found what the root of all evil was - The GC. After disabling it, the program runs fine.

Re: Segfault in "_d_dynamic_cast ()"

2013-01-24 Thread Minas Mina
On Thursday, 24 January 2013 at 13:22:20 UTC, Maxim Fomin wrote: On Thursday, 24 January 2013 at 10:14:29 UTC, Minas Mina wrote: I am trying to create a BVH tree structure to speed up raytracing. So far it has been fine. I have created the BVH tree. It works for 202 triangles/spheres

Segfault in "_d_dynamic_cast ()"

2013-01-24 Thread Minas Mina
I am trying to create a BVH tree structure to speed up raytracing. So far it has been fine. I have created the BVH tree. It works for 202 triangles/spheres. However, when the scene has more spheres/triangles, I get a segmentation fault when the rays are traces, not when the tree is being buil

Re: tiny std.datetime question

2013-01-16 Thread Minas Mina
On Wednesday, 16 January 2013 at 14:15:46 UTC, n00b wrote: Nevermind, found it myself. SysTime* sys = new SysTime(standardTime, UTC()); sys.hour; Le 16/01/2013 08:07, n00b a écrit : Hello, I'm kinda ashamed to ask that here, but std.datetime documentation is so complex... I only want to get h

Re: structs are now lvalues - what is with "auto ref"?

2012-12-29 Thread Minas Mina
So when it will be fixed I will be able to write: void foo(auto ref Vector3 v); and it will pass copies or references depending on the situation?

Re: structs are now lvalues - what is with "auto ref"?

2012-12-28 Thread Minas Mina
On Friday, 28 December 2012 at 12:47:03 UTC, Namespace wrote: On Friday, 28 December 2012 at 12:28:01 UTC, bearophile wrote: Namespace: How likely is it that "auto ref" will implemented in this release? Walter wants to release 2.061 "soon". So maybe that's for the successive (unstable?) ver

Re: structs are now lvalues - what is with "auto ref"?

2012-12-24 Thread Minas Mina
On Sunday, 23 December 2012 at 23:59:55 UTC, Jonathan M Davis wrote: On Monday, December 24, 2012 00:48:01 Namespace wrote: but Andrei is dead set against - Jonathan M Davis Why?

Re: Passing rvalues to functions expecting const ref

2012-12-23 Thread Minas Mina
On Sunday, 23 December 2012 at 20:40:09 UTC, Namespace wrote: Minas Mina: Show me the whole code, I think that your opBinary functions returns rvalues. This would be a good and important case for "auto ref". But until now it is only for template paramters... struct Vector3 {

Re: Passing rvalues to functions expecting const ref

2012-12-23 Thread Minas Mina
On Sunday, 23 December 2012 at 12:08:47 UTC, Namespace wrote: As long as you use structs this should work, as you can see here: http://dpaste.dzfl.pl/03adf3d1 But if you use classes, it does not work anymore. So I like it a lot, that it works with structs. :) Thank you. I had forgotten to supp

Re: Static compiling with dmd

2012-12-12 Thread Minas Mina
On Wednesday, 12 December 2012 at 14:28:48 UTC, Zardoz wrote: How I can compile with static linking with dmd ? I try with dmd -L-static but i get this error : /usr/bin/ld: cannot find -lgcc_s I used before gdc with -static options and owrked well on it, but I need to use now dmd. Try usi

connect to an SQL Server database

2012-10-06 Thread Minas
Is there a library that I can use to connect to an SQL Server database? (I need to use it on both linux and windows).

Re: Handling DirectX 9 texture

2012-09-12 Thread Minas
On Tuesday, 11 September 2012 at 12:06:29 UTC, ElfQT wrote: Hi. I would like some sample code which demonstrates how can I modify a DirectX 9 texture. (C++ or D, doesn't matter.) I have a texture, like a billboard, and I would like to draw on that. I already looked on google, on different ga

typeof(enum)

2012-09-07 Thread Minas
import std.stdio; enum PI = 3.14; void main() { writeln(typeid(typeof(PI))); } It prints "double". Shouldn't it be immutable(double). I think it would make more sense, as it is a constant. Plus, it could be shared among threads.

Re: Check for ctfe

2012-08-25 Thread Minas Mina
Why is it "if( __ctfe )" and not static if.. ?

types of ranges

2012-08-24 Thread Minas Mina
Is there n article that explains the different types of Ranges? (InputRange, ForwardRange, etc) and their usage?

struct with @disable(d) default constructor doesn't work with arrays?

2012-08-22 Thread Minas Mina
I have this struct: struct S { int[] t; @disable this(); this(int sz) { t = new int[sz]; t[] = 1; } S opCall(int sz) { S s = S(sz); return s;

Re: stdlib.exit()

2012-08-20 Thread Minas
I don't know about the runtime, but destructors are not called (not sure about module destructors) import std.stdio; import std.c.stdlib; void main() { S s; exit(-1); } struct S { ~this() { writeln("destructor"); } } This prints

Re: stdlib.exit()

2012-08-19 Thread Minas Mina
On Sunday, 19 August 2012 at 23:48:01 UTC, Minas Mina wrote: That's what I do: import std.c.stdlib; void main(string[] args) { if( args.length == 1 ) { writeln("Some arguments, please!"); exit(-1); } } Sorry, forgot to import std.stdio.

Re: stdlib.exit()

2012-08-19 Thread Minas Mina
That's what I do: import std.c.stdlib; void main(string[] args) { if( args.length == 1 ) { writeln("Some arguments, please!"); exit(-1); } }

Re: Link .s file with dmd?

2012-08-13 Thread Minas Mina
On Monday, 13 August 2012 at 22:06:08 UTC, Namespace wrote: Can i link an assembler file .s with dmd like gcc with "gcc out.s any.c -o out.exe"? If so, how? .s, .c, .d files (source files), are not linked. What is linked, are object files (.obj or .o). GCC either compiles the .s file to an o

Re: Function that calculates in compile time when it can

2012-08-06 Thread Minas Mina
On Monday, 6 August 2012 at 15:56:52 UTC, Namespace wrote: Take a look into std.math: https://github.com/D-Programming-Language/phobos/blob/master/std/math.d I found this: real sin(real x) @safe pure nothrow; /* intrinsic */ And these: creal sin(creal z) @safe pure nothrow { creal cs =

Re: Function that calculates in compile time when it can

2012-08-06 Thread Minas Mina
On Monday, 6 August 2012 at 15:21:38 UTC, Philippe Sigaud wrote: On Mon, Aug 6, 2012 at 3:54 PM, Minas Mina wrote: Something like this: template fib(ulong n) { static if( n < 2 ) const fib = n; else const fib = fib!(n-1) + fib!(

Re: Function that calculates in compile time when it can

2012-08-06 Thread Minas Mina
On Monday, 6 August 2012 at 15:21:38 UTC, Philippe Sigaud wrote: On Mon, Aug 6, 2012 at 3:54 PM, Minas Mina wrote: Something like this: template fib(ulong n) { static if( n < 2 ) const fib = n; else const fib = fib!(n-1) + fib!(

Re: Function that calculates in compile time when it can

2012-08-06 Thread Minas Mina
zfl.pl/e3f26239 Minas : I don't know if your PC is outdated, but it's weird. :/ It's Ubuntu 12.04 running on an Intel i5. That's what I tried to calculate: static x = fib(40); ulong fib(ulong n) { if(n < 2) return n; else

Re: Function that calculates in compile time when it can

2012-08-06 Thread Minas Mina
Something like this: template fib(ulong n) { static if( n < 2 ) const fib = n; else const fib = fib!(n-1) + fib!(n-2); if( n < 2) return n; return fib(n-1) + fib(n-2); } It doesn't work of course, as I am in

Re: Error while trying to allocate memory (malloc)

2012-08-06 Thread Minas Mina
Maybe you need a cast before malloc to convert it to a "s_blockInfo*"?

Function that calculates in compile time when it can

2012-08-06 Thread Minas Mina
I want to write a fibonacci(n) function that calculates the result. a) if n is known at compile time, use a template b) if not, use a normal function I know how to write a template version: template fib(ulong n) { static if( n < 2 ) const fib = n; else

Re: How to define a constructor in a struct?

2012-08-05 Thread Minas Mina
On Sunday, 5 August 2012 at 16:42:16 UTC, Adam D. Ruppe wrote: On Sunday, 5 August 2012 at 16:30:48 UTC, Minas Mina wrote: Thank you. Is it the way it is to have compatibility with C structs? I'm not sure... I think so in part, but I think another part of it is to make sure that s

Re: How to define a constructor in a struct?

2012-08-05 Thread Minas Mina
Thank you. Is it the way it is to have compatibility with C structs?

How to define a constructor in a struct?

2012-08-05 Thread Minas Mina
I want to make a struct that defines a constructor: struct Point { this() { } } However I get a compiler error: "constructor main.Point.this default constructor for structs only allowed with @disable and no body" I wrote a @disable next to it but same error. I don't u

Re: sorting failed error

2012-07-31 Thread Minas
On Tuesday, 31 July 2012 at 09:41:31 UTC, maarten van damme wrote: I now tried to bring it to the next level, using concurrency to bread a couple of populations and make the best solutions migrate between them. But, to use concurrency in D, one has to continually cast between immutable, cast

Re: Implementing a Monitor

2012-07-31 Thread Minas
Thank you for your reply. I have some more questions: I simplified my example. Now my monitor is used for mutual exclusion, to understand how monitors work first. // 3 threads are running P() - the main thread is not one of them void P() { while( run ) { monit

Re: Detector for unused variables

2012-07-31 Thread Minas
I agree that having the compiler make warnings about unused variables is a really good idea!!! Java has it and when I program in eclipse it's really useful because the editor can highlight the particular lines.

Re: Is "delete" really going away?

2012-07-29 Thread Minas Mina
Thanks for the answers. So clear() or destroy() in 2.060 be used to call the destructor, but the actual memory of the object won't be freed, right? Is this is true, why wasn't "delete" changed to behave like destroy()?

Is "delete" really going away?

2012-07-29 Thread Minas Mina
I think having the delete keyword for classes was a very good thing, altough I don't know the problems it has for the GC and probably other things. Consider this scenario: class Base { // ... } class Derived : Base { // ... FILE *f; this()

Implementing a Monitor

2012-07-27 Thread Minas Mina
I'm using condition variables to implement a monitor that simulates the producer-consumer(unbounded buffer) scenario. Note: monitor is __gshared and is initialized in main(). Then the other threads are created and run. There is one producer thread, and 5 consumer threads. void producer() {

profiling with -profile

2012-07-26 Thread Minas Mina
I have this code: import std.stdio; void main() { f(); g(); } void f() { writeln("f()"); } void g() { writeln("g()"); } I compile with the command: dmd test.d -profile Then I execute it. It prints: f() g() as expected. Shouldn't it print profiling informatio

Re: profiling with -profile

2012-07-26 Thread Minas Mina
Sorry, I just saw the generated file... :p

Re: deimos libX11 undefined reference

2012-07-14 Thread Minas Mina
Try -L-lX11

Re: Creating a shared reference type

2012-07-14 Thread Minas Mina
On Saturday, 14 July 2012 at 09:21:27 UTC, David Nadlinger wrote: On Saturday, 14 July 2012 at 09:15:55 UTC, Minas Mina wrote: Isn't this the way shared is used (or should be used)? Should be used: probably yes. But functions/methods which are able to act on shared data must be marke

Re: Creating a shared reference type

2012-07-14 Thread Minas Mina
Thanks, I've got another problem: void f() { sema.wait(); ++x; sema.notify(); } sema is the global shared Semaphore (as above) main.d(29): Error: function core.sync.semaphore.Semaphore.wait () is not callable using argument types () shared main.d(29):

Creating a shared reference type

2012-07-13 Thread Minas Mina
I'm want to "play" a bit with thread syncronization... So this is a (big) part of my code. The other is the imports, the thread starting and the printing of x. shared int x; shared Semaphore sema; void main(string[] args) { auto t1 = new Thread(&f); auto t2 = new Thread(&g);

Re: Immutable array initialization in shared static this

2012-07-13 Thread Minas Mina
I guess it's because you have an array of constants (immutables). The array is not immutable though. I could be wrong, I'm not an expert or D syntax :)

Re: immutability and constness

2012-07-12 Thread Minas Mina
On Thursday, 12 July 2012 at 14:42:17 UTC, Ali Çehreli wrote: On 07/12/2012 07:13 AM, Minas wrote: Thanks a lot! So what is the problem with (logical)const? Is it needed that much? And why some methods (toString(), toHash()) HAVE to be const? I mean, what's the problem if they aren't?

Re: immutability and constness

2012-07-12 Thread Minas
Thanks a lot! So what is the problem with (logical)const? Is it needed that much? And why some methods (toString(), toHash()) HAVE to be const? I mean, what's the problem if they aren't?

immutability and constness

2012-07-11 Thread Minas Mina
I'm fairly new to D, but I have been using C++ for a while now (about 5 years, selftaught). From what I have learned, const in C++ is inconsistent. For example: int main() { const int x = 0; // could be placed in ROM because it's known at compile time } void f(int x) { const int y = x

Re: Concurrency in D

2012-06-28 Thread Minas Mina
On Wednesday, 27 June 2012 at 23:50:17 UTC, Ali Çehreli wrote: On 06/27/2012 04:05 PM, Adam Burton wrote: >> For example I would like to >> have a thread calculate the sum of the first half of an array >> while another thread would calculate the other half, and I could >> add the two results at

Re: Concurrency in D

2012-06-27 Thread Minas Mina
You all helped, thank you :) I will read the concurrency part tomorrow!

Concurrency in D

2012-06-27 Thread Minas Mina
I have been "playing" latetly with std.concurrency and core.thread. I like both, but they are entirely different approaches to concurrency. std.concurrency: Uses message passing. Does not allow passing of mutable types. core.thread: Essentially the same as the approach taken by Java. 1) Is o

Re: Removing from SList (std.container)...

2012-06-27 Thread Minas Mina
Doesn't Andrei plan to do something about this module?

Re: Removing from SList (std.container)...

2012-06-27 Thread Minas Mina
Thank you for your reply. Yes, std.container really sucks. Anyway, I made my program using C++ and STL

Re: Removing from SList (std.container)...

2012-06-27 Thread Minas Mina
On Wednesday, 27 June 2012 at 09:52:14 UTC, Tobias Pankrath wrote: On Wednesday, 27 June 2012 at 09:37:01 UTC, Minas Mina wrote: How can I do that? Why not list.remove(x); like in STL? std.container encodes the complexity of operations in the method names. There is no way to remove a range

Removing from SList (std.container)...

2012-06-27 Thread Minas Mina
How can I do that? Why not list.remove(x); like in STL?

Re: Strange exception using threads

2012-06-23 Thread Minas Mina
Thank you very much :) I like the "you are done :)" approach!

Re: Writing .di files

2012-06-22 Thread Minas Mina
I'm sorry, what I meant was "how to interface to C code". Sorry for writing it in a bad way. Do I just declare the C code as extern and then link together with the C .lib/.o/.so file? (I'm in Ubuntu) What about the stuff that is in header files?

Re: floats default to NaN... why?

2012-06-09 Thread Minas
With ints, the best we can do is 0. With floats, NaN makes it better. With the logic that NaN is the default for floats, 0 is a very bad choice for ints. It the worst we could do. Altough I understand that setting it to something else like -infinity is still not a good choice. I think that

Re: floats default to NaN... why?

2012-06-08 Thread Minas
The idea isn't being "practical" exactly. The idea was to use invalid values as defaults. Unfortunately things like ints don't have invalid values, so they chose zero. The idea is to make people initialize their variables. I understand the logic, but I still disagree. No offense :) I don't

Re: floats default to NaN... why?

2012-06-07 Thread Minas
I agree that the default value for floats/doubles should be zero. It feels much more natural. I think the problem here is that people are thinking about some stuff too much. D is a rather new language that wants to be practical. Floats defaulting to NaN is NOT practical FOR MOST PEOPLE when a

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
Oops, that doesn't fix the error. Seg. faults occurs...

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
I think I found it! I have modified main: void main() { DerelictSDL.load(); int val = SDL_Init(SDL_INIT_EVERYTHING); writeln(val); SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); writeln("ok"); DerelictSDL

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
It certainly doesn't happen inside SDL_Init because "writeln()" is shown even when the seg. fault occurs... It has to be inside SDL_SetVideoMode.

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
I forgot about that :p Here it is: Starting program: /home/minas/Projects/OpenGL/D_template/D_template/bin/Debug/D_template [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffee989700 (LWP 13351

[Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
, SDL_SWSURFACE); } [/code] But sometimes (at about 3-5 runs), I get a segmentation fault! 0 bash: line 1: 12951 Segmentation fault (core dumped) /home/minas/Projects/OpenGL/D_template/D_template/bin/Debug/D_template 0 is the return value of SDL_Init, so everything ok here. I don't kno

Re: Linking to static libraries

2012-05-10 Thread Minas
I figured it out, this is the correct: -L-L/usr/lib/Derelict2 -L-lDerelictSDL -L-lDerelictUtil -L-ldl I don't know why, but the dl library is needed. Thank you for your help.

Re: Linking to static libraries

2012-05-10 Thread Minas
On Thursday, 10 May 2012 at 13:14:36 UTC, Jacob Carlborg wrote: On 2012-05-10 14:55, Minas wrote: I have a static library (libDerelictSDL2.a) in /usr/lib/Derelict3. What I want to to is just link to that. My code does not use anything from it. My .d file is icy.d. I try to compile using: a

Linking to static libraries

2012-05-10 Thread Minas
I have a static library (libDerelictSDL2.a) in /usr/lib/Derelict3. What I want to to is just link to that. My code does not use anything from it. My .d file is icy.d. I try to compile using: a) dmd icy.d -I/usr/lib/Derelict3 -L-lDerelictSDL2 b) dmd icy.d -L-I/usr/lib/Derelict3 -L-lDerelictSDL

problem parsing xml (std.xml)

2012-05-06 Thread Minas
I'm trying to use std.xml to parse a small snippet of xml (for now). This is my code: [code] void main(string[] args) { string xmlText = "\n" ~ "" ~ " Test" ~ "";

How to make a directory?

2012-05-01 Thread Minas
What is the D way to create a directory? I can use the C function system("mkdir ...") but it doesn't seem very good to me. Also, is there a way to require the root password of the user when going create the directory in a restricted folder (like /usr) AFTER the application has started? Tha

Re: Creating a file in ~/.config (ubuntu)

2012-04-13 Thread Minas
On Friday, 13 April 2012 at 16:41:01 UTC, Bystroushaak wrote: Use std.path.expandTilde() -> http://dlang.org/phobos/std_path.html#expandTilde Thank you very much! That did the trick! auto f = File(expandTilde("~/.config/test.txt","w"));

Creating a file in ~/.config (ubuntu)

2012-04-13 Thread Minas
I am trying to create a file in ~/.config My code is: [code] import std.stdio; void main() { auto f = File("~/.config/minas.txt", "w"); } [/code] However, an exception is thrown. std.exception.ErrnoException@std/stdio.d(288): Cannot open file `~/.config/minas.txt' in mode `w' (No such

Re: D slower ~1s from C ?!

2012-04-06 Thread Minas
On Thursday, 5 April 2012 at 23:23:54 UTC, Kapps wrote: On Thursday, 5 April 2012 at 17:22:38 UTC, Minas wrote: First, you should compile with -O -release -inline and, in this case, -noboundscheck. return false; Results in a 26 times performance increase for me, based off of

[Ubuntu] Linking to static libraries

2012-03-28 Thread Minas
There's a small C graphics library called GP142, which I am trying to port to D on Linux (Ubuntu). So I compiled the library in gcc, and that gave me the file gp142.o which I must link together with my D source file. My code is very simple. I declare the two simplest functions in GP142, and