x64 Link Issues - Can someone please help?

2013-04-19 Thread Trey Brisbane
Hey all, I'm currently using D for a hook-based project that requires me to build both a 32bit and 64bit DLL. Naturally, the 32bit DLL builds fine, however I'm encountering linking issues for the 64bit. I followed the instructions at

Re: Assigning a static array

2013-04-19 Thread Steven Schveighoffer
On Thu, 18 Apr 2013 18:13:14 -0400, Ali Çehreli acehr...@yahoo.com wrote: Interesting. Personally, I would not even bother with the second one and expect the caller to simply put square brackets around the arguments: [snip] It is now safe, right? Yes, for this case it is OK. But I

Re: Assigning a static array

2013-04-19 Thread Steven Schveighoffer
On Thu, 18 Apr 2013 18:08:48 -0400, bearophile bearophileh...@lycos.com wrote: To avoid those bugs I have suggested the simpler possible thing: (V[] elems...) to dup the data on the heap every time. In theory if you write (scope V[] elems...) it will be free to not dup the data, avoiding the

Re: Assigning a static array

2013-04-19 Thread Steven Schveighoffer
On Thu, 18 Apr 2013 19:15:06 -0400, H. S. Teoh hst...@quickfur.ath.cx wrote: I'm all for making this @system at the very least, if not outright compile error. Storing a persistent reference to a stack-allocated object is outright wrong... in the case of variadic array args, if the compiler

Re: Assigning a static array

2013-04-19 Thread bearophile
Steven Schveighoffer: we increasingly need scope to work for D to be easy to avoid mistakes. But I don't see any plan/implementation timeframe for scope :-( I don't know why. I'd like to know Hara opinion on this. Bye, bearophile

Re: writeln an object

2013-04-19 Thread gedaiu
Ok, i understand now the diference... my question is how I should solve this problem? Thanks, Bogdan On Thursday, 18 April 2013 at 20:57:23 UTC, Ali Çehreli wrote: On 04/18/2013 12:37 PM, John Colvin wrote: However, by a wider definition of the word, a struct could also be said to be an

Quadratic time to sort in a simple case?

2013-04-19 Thread Ivan Kazmenko
Hi! Consider a sorted array. Append an element that is less than all the previous elements. Then sort the array again by the sort function from std.algorithm. An example follows: - import std.algorithm; import std.datetime; import std.range; import std.stdio; void main () {

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread bearophile
Ivan Kazmenko: Consider a sorted array. Append an element that is less than all the previous elements. Then sort the array again by the sort function from std.algorithm. If you know that, then don't do a sort. Make some free space in the array, shift the items, sort just the first part

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread Dmitry Olshansky
20-Apr-2013 01:03, Ivan Kazmenko пишет: With n = 30_000 as in the example, this takes time of the order of a second on a modern computer, which is clearly O(n^2). I am using DMD 2.062. Optimization flags if any? -- Dmitry Olshansky

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread Ivan Kazmenko
With n = 30_000 as in the example, this takes time of the order of a second on a modern computer, which is clearly O(n^2). I am using DMD 2.062. Optimization flags if any? Both -O and no-flags give quadratic behavior. Well, if that does not convince you the time grows faster than

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread Dmitry Olshansky
20-Apr-2013 02:12, Ivan Kazmenko пишет: With n = 30_000 as in the example, this takes time of the order of a second on a modern computer, which is clearly O(n^2). I am using DMD 2.062. Optimization flags if any? Both -O and no-flags give quadratic behavior. I sought after -O -inline

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread bearophile
Ivan Kazmenko: A seemingly easy way to provide the choice globally would be to have an assignable SwapStrategy.default in std.algorithm... or would that be a bad design decision to have such a global state? With that I think there is no way to write a pure sort. Hopefully someday the sort()

Re: Assigning a static array

2013-04-19 Thread bearophile
Steven Schveighoffer: we increasingly need scope to work for D to be easy to avoid mistakes. I have added a note about scope: http://d.puremagic.com/issues/show_bug.cgi?id=5212 Bye, bearophile

Win32 + OpenGL bindings

2013-04-19 Thread Diggory
I've been trying to write a win32 app using opengl in D, but none of the bindings I've found have been sufficient: - core.sys.windows.windows: Missing large parts of wingdi.h, including PFD_* constants, ChoosePixelFormat(), SwapBuffers(), wgl*() functions. - win32.windows: Apparantly out of

Re: x64 Link Issues - Can someone please help?

2013-04-19 Thread dnewbie
phobos64.lib(dmain2_4ac_1a5.obj) : error LNK2019: unresolved external symbol _Dmain referenced in function main Please add -L/DLL to the command line.