Re: Get and set terminal size

2014-04-19 Thread Mike Parker via Digitalmars-d-learn
On 4/19/2014 9:06 PM, FreeSlave wrote: Note that you don't need to apply toStringz to string literals since they implicitly cast to const char*. And, more importantly, are nul terminated.

Re: DMD Deimos || GDC Deimos?

2014-04-26 Thread Mike Parker via Digitalmars-d-learn
On 4/27/2014 3:18 AM, Entry wrote: I'd like to use GLFW from Deimos, but I couldn't get it to work (DMD said it cannot use libglfw.a) and I've read somewhere that only GDC can use these DLLs directly (with a D header, but that's still better than hooking the methods). So do I need GDC for that

Re: import with renaming and public import inside module

2014-04-29 Thread Mike Parker via Digitalmars-d-learn
On 4/29/2014 8:25 PM, ketmar wrote: On Tuesday, 29 April 2014 at 11:10:06 UTC, anonymous wrote: specifically, it was derelict sdl bindings. that module itself does public imports, so issue is more complicated. sorry for me being rude. What, exactly, is the problem you are having with public

Re: ncurses linking(?) problem on Mac OS X

2014-05-03 Thread Mike Parker via Digitalmars-d-learn
On 5/3/2014 9:36 PM, Joakim wrote: Terminated, exit code: 2 I have no idea where to go from here to be honest. It's probably something easily fixed for someone even a tiny bit more experienced. I would love some help if anyone feels up to it. Have you actually installed

Re: Is this a bug?

2014-05-04 Thread Mike Parker via Digitalmars-d-learn
On 5/4/2014 6:42 PM, Alex wrote: Hello, I am trying to use the std.log module that is here: https://github.com/linkrope/log.d And I encountered a segmentation fault using dmd 2.065 on a Linux 64 platform. The reduced test case is this:

Re: Is this a bug?

2014-05-04 Thread Mike Parker via Digitalmars-d-learn
On 5/4/2014 7:39 PM, monarch_dodra wrote: Really??? I knew there was no guarantee in which order the destructor were run, but at the very least, I thought you had a guarantee of dependency ordering? Furthermore, the order in which the garbage collector calls destructors for unreference

Re: Is this a bug?

2014-05-05 Thread Mike Parker via Digitalmars-d-learn
On 5/5/2014 5:40 AM, Alex wrote: Thank you, but I find it to be quite awkward. Why the compiler does not complain or, at least, give a more meaningful runtime error message? Is there any official std.log that is destructor-safe? There is no official std.log at all.

Re: Reading ELF Files

2014-05-05 Thread Mike Parker via Digitalmars-d-learn
On 5/5/2014 8:17 PM, Nordlöw wrote: One thing though: You cannot call a filename the same as a keyword: package.d because import elf.package; fails with fs.d(144,12): Error: identifier expected following package Actually, package.d is a feature which was added not so long ago. Given: -

Re: newbie question about dub

2014-05-07 Thread Mike Parker via Digitalmars-d-learn
On 5/7/2014 10:41 PM, Mike Parker wrote: On 5/6/2014 8:29 PM, Oleg wrote: QUESTION: How to define the dfuse library version of I'm doing it wrong way? I believe you might find this thread[1] in the dub forum helpful. Sorry, wrong link. It should be:

Re: newbie question about dub

2014-05-07 Thread Mike Parker via Digitalmars-d-learn
On 5/6/2014 8:29 PM, Oleg wrote: QUESTION: How to define the dfuse library version of I'm doing it wrong way? I believe you might find this thread[1] in the dub forum helpful. [1] http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/thread/1328/

Re: DerelictAL Symbol undefined

2014-05-19 Thread Mike Parker via Digitalmars-d-learn
On 5/19/2014 10:59 PM, Jack wrote: Code: http://pastebin.com/pQjH3jRs Error code is this: Error 42: Symbol Undefined _D3std7windows8syserror14sysErrorStringFNekZAya --- errorlevel 1 I'm currently using Xamarin Studio and the compiler spewed this error out. I searched around and it said that

Re: DerelictAL with alut?

2014-05-23 Thread Mike Parker via Digitalmars-d-learn
On 5/23/2014 6:01 PM, Jack wrote: On Friday, 23 May 2014 at 08:36:29 UTC, Rene Zwanenburg wrote: On Friday, 23 May 2014 at 08:17:28 UTC, Jack wrote: Erm excuse me. Does the current DerelictAL come with alut bindings? If not, does it come with libaudio then? I saw this very old page on the

Re: DerelictAL with alut?

2014-05-23 Thread Mike Parker via Digitalmars-d-learn
On 5/23/2014 6:11 PM, Rene Zwanenburg wrote: http://kcat.strangesoft.net/alure-docs/files/alure-cpp.html Hrm. I looked all over the ALURE homepage for a link to online docs. Thanks for posting it.

Re: Building 32bit program with MSVC?

2014-05-30 Thread Mike Parker via Digitalmars-d-learn
On 5/30/2014 3:25 AM, Jeremy DeHaan wrote: I know that we can use MSVC to build a 64 bit program, but is it also possible to use it to build a 32 bit program as well? If you mean using the MSVC toolchain with DMD, then the answer is no, not at the moment. Rainer has done some work toward

Re: problem with Access Violation, and I'm not sure where

2014-06-11 Thread Mike Parker via Digitalmars-d-learn
On 6/11/2014 2:14 PM, Matt wrote: window = SDL_CreateWindow (cfg[window][caption].str.ptr, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_SHOWN); I'm curious -- does cfg[][].str ensure that the string is null terminated? Because if it doesn't, you've got

Re: Basics of calling C from D

2014-06-12 Thread Mike Parker via Digitalmars-d-learn
On 6/12/2014 12:17 AM, Colin wrote: So a find an replace will do that for you quite easily. Other things like structs and typedefs are a bit more difficult to do with a find replace. All the info you need is here anyway: wiki.dlang.org/Bind_D_to_C And here:

Re: Equivalent of C++ std::function

2014-06-24 Thread Mike Parker via Digitalmars-d-learn
On 6/25/2014 10:10 AM, Yuushi wrote: I was wondering if D had something akin to std::function in C++. Say I have some functions in an associative array, for example: auto mapping = ['!' : (string a) = toUpper!string(a), '^' : (string a) = capitalize!string(a)]; What I want to do is

Re: What am I doing Wrong (OpenGL SDL)

2014-07-04 Thread Mike Parker via Digitalmars-d-learn
On 7/4/2014 6:39 PM, Sean Campbell wrote: On Friday, 4 July 2014 at 08:02:59 UTC, Misu wrote: Can you try to add DerelictGL3.reload(); after SDL_GL_CreateContext ? yes this solved the problem. however why? is it a problem with the SDL binding? OpenGL on Windows requires a context be created

__VERSION__ and the different compilers

2014-07-09 Thread Mike Parker via Digitalmars-d-learn
Is it safe to assume that __VERSION__ is the same among DMD, LDC and GDC when using the equivalent front-end? I want to implement @nogc in Derelict in a backward compatible way. The simple thing to do is (at the suggestion of w0rp): static if( __VERSION__ 2.066 ) enum nogc = 1; I just want

Re: OSX, Need help with Compiling and linking errors

2014-07-13 Thread Mike Parker via Digitalmars-d-learn
On 7/13/2014 2:28 PM, Israel Rodriguez wrote: What about the dub libraries, what kind of errors do you get if you try to use a library not compatible for your system, say OSX or Linux? Im assuming the same linking errors but im not sure. dub doesn't download library binaries, but the source.

Re: teething troubles

2014-07-17 Thread Mike Parker via Digitalmars-d-learn
On 7/17/2014 7:01 PM, Dean wrote: Not even sure if its a tango problem. Dmd doesn't seem to be picking up the path that I specify with -I. Perhaps the mechanics of module loading is not as simple as I imagine. I initially thought its a permission problem, but that is not the case. What does

Re: Code spliting in module and packages

2014-07-21 Thread Mike Parker via Digitalmars-d-learn
On 7/21/2014 7:13 AM, Matthieu wrote: Hi! I can't find any good tutorial about how to split my source code in modules and packages. I don't want to use a Java splitting style (one class per file) or something like that, I want to use the D way, but it's so hard to find it! Can someone explain

Re: Really nooB question - @property

2014-07-21 Thread Mike Parker via Digitalmars-d-learn
On 7/21/2014 3:14 AM, Eric wrote: Use @property when you want a pseudo-variable or something that might be conceptually considered a property of the object, i.e. to do this: auto blah = thing.someProperty; thing.someProperty = blahblah; This is basically what I suspected. But why write:

Re: Programming a Game in D? :D

2014-08-02 Thread Mike Parker via Digitalmars-d-learn
On 8/3/2014 5:38 AM, David wrote: Hi, not too sure if there's still someone reading this post, but i do have another question. So, I heared so much good stuff about D, it's powerfull, fast the syntax is nice, but well, why is D actually not used for common games yet? (I mean I know about some

Re: building a D app with multiple source files

2014-08-05 Thread Mike Parker via Digitalmars-d-learn
On 8/5/2014 5:06 PM, nikki wrote: On Tuesday, 5 August 2014 at 07:57:57 UTC, Vladimir Panteleev wrote: On Tuesday, 5 August 2014 at 07:51:53 UTC, nikki wrote: Correction: rdmd -Isource example/source/app.d that one worked, woohoo thanks. what did the -Isource do? it's not in the 'rdmd

Re: Dub failing to detect Shared Libraries

2014-08-05 Thread Mike Parker via Digitalmars-d-learn
On 8/6/2014 2:53 AM, Rishub Nagpal wrote: I am porting DerelictBGFX to linux, but I am having some problems. When I run the dub command in my example directory, I get the following error :

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-24 Thread Mike Parker via Digitalmars-d-learn
On 8/23/2014 7:19 PM, nikki wrote: How would you write it? ``` // Put this somewhere you can import it into any module calling SDL class SDLError : Error { public this( string msg, string file = __FILE__, size_t line = __LINE__ ) { import std.string; import std.conv;

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-24 Thread Mike Parker via Digitalmars-d-learn
On 8/25/2014 11:35 AM, Vladimir Panteleev wrote: On Monday, 25 August 2014 at 02:17:47 UTC, Mike Parker wrote: // Put this somewhere you can import it into any module calling Small modification for even terser error handling: T sdlEnforce(T)(T result, string message = null) { if (!result)

Re: Learning D

2014-08-26 Thread Mike Parker via Digitalmars-d-learn
On 8/26/2014 5:37 AM, Ryan wrote: Then I thought I'd learn dub. Well, this is NOT going well... I did a git clone of gtk-d, then tried to build with dub (renamed the package.json to dub.json), and it told me Conflicting package multi-reference I have no clue and I've tried removing package

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-27 Thread Mike Parker via Digitalmars-d-learn
On 8/27/2014 2:39 PM, Vladimir Panteleev wrote: On Monday, 25 August 2014 at 03:19:09 UTC, Mike Parker wrote: I use Exception for recoverable errors and Error for those that aren't. Sorry, you're right, that description of Exception/Error is correct. But I don't think that SDL initialization

Re: Learning D

2014-08-27 Thread Mike Parker via Digitalmars-d-learn
On 8/27/2014 10:25 PM, Ryan wrote: DSSS, XfBuild, Bud, RDMD, or premake4. Especially DSSS vs DUB. Is DUB a replacement for DSSS? You can look at it that way. It's both a package manager and build tool. DSSS was abandoned long ago. Why not other tools -- XfBuild is no longer maintained

Re: whats happening to my binary file size?

2014-08-27 Thread Mike Parker via Digitalmars-d-learn
On 8/28/2014 1:24 AM, Israel wrote: On Wednesday, 27 August 2014 at 09:23:57 UTC, Marc Schütz wrote: But, how would i configure dub and my dub.json to automatically use those LDC switches if it isnt automatically built into dub? You can pass compiler-specific flags by adding a dflags entry

Re: Strange segfault (Derelict/OpenGL)

2014-08-29 Thread Mike Parker via Digitalmars-d-learn
On 8/29/2014 9:16 PM, Robin Schroer wrote: On Friday, 29 August 2014 at 11:51:47 UTC, Marc Schütz wrote: display.Display.render() is what tries to render the triangle using a glBegin-block. Some code would be helpful. My first thought is that you aren't loading properly. DerelictGL3 does

Re: Strange segfault (Derelict/OpenGL)

2014-08-30 Thread Mike Parker via Digitalmars-d-learn
On 8/30/2014 11:12 PM, Robin Schroer wrote: Some code would be helpful. My first thought is that you aren't loading properly. DerelictGL3 does not load deprecated functions, but you're trying to call a deprecated function. Are you loading DerelictGL or DerelictGL3? So, I dug around a lot. I

Re: String Theory Questions

2014-09-14 Thread Mike Parker via Digitalmars-d-learn
On 9/14/2014 2:09 AM, WhatMeWorry wrote: The name string is aliased to immutable(char)[] Why was immutable chosen? Why not mutable. Or why not just make another alias called strung where it is aliased to mutable(char)[] If you want a mutable array of characters, just use char[]. --- This

Re: [DerelictAlure] Error loading libdumb.so etc...

2014-09-20 Thread Mike Parker via Digitalmars-d-learn
On 9/20/2014 3:47 PM, Jack wrote: I've configured dub to build DerelictAlure for my project which only contains the example code shown in: https://github.com/DerelictOrg/DerelictALURE The build was successful though when I tried to run it, they were spewing out that they need some sort of .so

Re: Trying to get Derelict.opengl3.gl3 and derelict.glfw3.glfw3 to work together

2014-09-24 Thread Mike Parker via Digitalmars-d-learn
On 9/24/2014 12:08 PM, csmith wrote: Hi everyone, Compiling... source/app.d(25): Error: undefined identifier glBegin source/app.d(26): Error: undefined identifier glEnd FAIL .dub/build/application-debug-linux.posix-x86_64-dmd-357CCD4CB91CACEC384AF7BAA514E3A7 myproj

Re: DUB warnings causing failure?

2014-09-28 Thread Mike Parker via Digitalmars-d-learn
On 9/28/2014 11:31 PM, Nordlöw wrote: Running dmd... ../../.dub/packages/dchip-master/src/dchip/cpCollision.d(350): Warning: instead of C-style syntax, use D-style syntax 'MinkowskiPoint[3] hull' FAIL

Re: Invalid Assembly Generated

2014-10-04 Thread Mike Parker via Digitalmars-d-learn
On 10/4/2014 6:40 PM, Bauss wrote: I am not able to run the output file compiled. I am not sure if it might be an error with my commandline or not. Operating System: Windows 8 Commandline Arguments Try1: -c hello.d out\hello.exe Commandline Arguments Try2: -c hello.d -m32 out\hello.exe Your

Re: Can someone explain how glfw3.dll gets created?

2014-10-14 Thread Mike Parker via Digitalmars-d-learn
On 10/14/2014 5:21 AM, WhatMeWorry wrote: I have a simple GLFW3 program running in Visual D integrated shell, that kept aborting at DerelictFLFW3.load() with a failed to load the shared libraries: glfw3.dll.' So I found a glfw3.dll somewhere and moved it into the project folder (I know this is

Re: extern (C) function call with const char * type will sometimes generate seg fault or core dump.

2014-10-16 Thread Mike Parker via Digitalmars-d-learn
On 10/16/2014 12:18 PM, dysmondad wrote: Since I've added this call, my program will sometimes but not always either generate a core dump or a seg fault. It seems that the issue is with the const char * parameter. I don't have a good grasp of the difference between the way D and C work for char

Re: extern (C) function call with const char * type will sometimes generate seg fault or core dump.

2014-10-16 Thread Mike Parker via Digitalmars-d-learn
On 10/16/2014 4:54 PM, Mike Parker wrote: On 10/16/2014 12:18 PM, dysmondad wrote: Since I've added this call, my program will sometimes but not always either generate a core dump or a seg fault. It seems that the issue is with the const char * parameter. I don't have a good grasp of the

Re: Why do some language-defined attributes have @ and some not?

2014-10-23 Thread Mike Parker via Digitalmars-d-learn
On 10/24/2014 7:20 AM, ketmar via Digitalmars-d-learn wrote: why can't i see that J. Random in recent discussion about deprecating prefix 'const'? the universal answer was: yes, break our code NOW! PLEASE! including people from the companies with big D codebases. There are people out there

Re: How do I use dub?

2014-10-24 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 October 2014 at 23:46:51 UTC, Minas Mina wrote: 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? You don't. That's what dub does by default.

Re: How do I use dub?

2014-10-24 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 October 2014 at 23:50:26 UTC, Minas Mina wrote: 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

Re: Basic DerelictOrg and Deimos question

2014-10-24 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 October 2014 at 18:16:52 UTC, Justin Whear wrote: On Fri, 24 Oct 2014 18:04:13 +, WhatMeWorry wrote: Just for clarity's sake, should I consider the DerelictOrg and Deimos (packages, projects, or libraries) as separate from one another? Or does DerelictOrg use Deimos behind

Re: dub fetch target redirection...

2014-10-29 Thread Mike Parker via Digitalmars-d-learn
On 10/29/2014 1:48 PM, WhatMeWorry wrote: It looks like dub fetch... is putting all packages at %appdata% path on my windows machine. Is there a way to redirect packages to a user specified path? You're not really supposed to worry about that. It's how dub manages the packages internally. Why

Re: D int and C/C++ int etc not really compatible when interfacing to C/C++

2014-11-02 Thread Mike Parker via Digitalmars-d-learn
On 11/2/2014 8:59 PM, Marc Schütz schue...@gmx.net wrote: On Saturday, 1 November 2014 at 21:00:54 UTC, Kagamin wrote: D claims compatibility with system C compiler, which usually have 32-bit int. ... and for C/C++ long which can be 32 or 64 bit, DMD recently introduced the types c_long and

Re: [SDL + TKD] Seg fault from creating DirectoryDialog

2014-11-04 Thread Mike Parker via Digitalmars-d-learn
On 11/4/2014 7:34 PM, Jack wrote: On Tuesday, 4 November 2014 at 08:30:34 UTC, Gary Willoughby Here's the main file: http://codepad.org/hu4r0ExB and Here's the module: http://codepad.org/ikXAzfdg Dependencies are DerelictSDL and Tkd. It's the most simple one I got that reproduces the

Re: Instructions for compilation from multiple source files

2014-11-10 Thread Mike Parker via Digitalmars-d-learn
On 11/10/2014 9:55 PM, Solomon E wrote: On Monday, 10 November 2014 at 12:21:51 UTC, bearophile wrote: That's not applicable because I'm not using DMD. Also that doesn't answer where a .o or .a file comes from, whether there's any difference between them besides the name, and if so what.

Re: Callbacks in D as void functions

2014-11-13 Thread Mike Parker via Digitalmars-d-learn
On 11/14/2014 12:58 AM, Wsdes wrote: Anyway, I think I got the problem solved. Well, there seems to never have been any problem as I am taught now. I asked the developer of the C API this morning if I should try to implement the callback functions redundantly in D and he said he will have a

Re: Howto use an alternative Linker with DUB?

2014-11-16 Thread Mike Parker via Digitalmars-d-learn
On 11/16/2014 6:46 AM, univacc wrote: Hi, I am sitting in front of this problems for hours now and I need help: I need the a linker that is capable of delayed DLL loading and apparently, OPTLINK does not provide this option. unilink and Microsofts incremental linker support it so I would like

Re: Dub / Derelict confusion

2014-11-19 Thread Mike Parker via Digitalmars-d-learn
On 11/19/2014 6:12 PM, Paul wrote: I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'dub' would be the sensible option for a beginner so I downloaded the

Re: help

2014-11-20 Thread Mike Parker via Digitalmars-d-learn
On 11/20/2014 3:38 PM, michael via Digitalmars-d-learn wrote: Hello All: when i am using std.net.curl to download a file that dosent exist on ftp sever,my code will get an execption like this ‍std.net.curl.CurlException@std\net\curl.d(3605

Re: Dub / Derelict confusion

2014-11-20 Thread Mike Parker via Digitalmars-d-learn
On 11/21/2014 5:57 AM, Paul wrote: This is a tad off topic now but I'm struggling to get a window on screen as SDL_CreateWindow is failing, here's what I've got: try{ DerelictSDL2.load(); }catch(Exception e){ writeln(Failed to load DerelictSDL2 :( %s, e.msg); return; } Before

Re: Dub / Derelict confusion

2014-11-20 Thread Mike Parker via Digitalmars-d-learn
On 11/21/2014 10:22 AM, Mike Parker wrote: You are adding anything You /aren't/

Re: Dub / Derelict confusion

2014-11-22 Thread Mike Parker via Digitalmars-d-learn
On 11/23/2014 3:52 AM, Paul wrote: Whenever I try to learn a new language I always seem to end up fighting the OS or the IDE rather than spending time where I should. Therefore, I'm going to put this idea on hold and stick to console programs for a while (tried to install ncurses as well

Re: DerelictOrg and SDL_Mixer

2014-11-25 Thread Mike Parker via Digitalmars-d-learn
On 11/25/2014 9:26 AM, torea wrote: Oh.. I didn't know about the DerelictSDL2Mixer.load()! I thought the initialization of sdl_mixer was done with DerelictSDL2.load() Every time you call DerelictFoo.load, you are loading exactly one library. You will never see a Derelict package that loads

Re: DerelictOrg and SDL_Mixer

2014-11-25 Thread Mike Parker via Digitalmars-d-learn
On 11/26/2014 4:42 AM, torea wrote: ok, so basically, each time I want to access some specific functions imported like: import derelict.sdl2.foo; I have to load it like this? DerelictSDL2foo.load(); Don't think of it that way. Think of it this way: you have to load every library you

Re: Dub / Derelict confusion

2014-11-25 Thread Mike Parker via Digitalmars-d-learn
On 11/26/2014 3:27 AM, Paul wrote: I've finally got this working - the SDL FAQ page sort of identifies the cause; the xorg dev files have to be installed before building SDL otherwise you end up with a 'non-x' version (not sure what you'd do with that!). I built SDL first and then tried

Re: Derelict / SDL error

2014-12-08 Thread Mike Parker via Digitalmars-d-learn
On 12/8/2014 10:37 PM, Paul wrote: I added this around the problem line to catch the problem: try{ SDL_RenderCopy(renderer, texture, sourceRect, destRect); } catch{} finally { writeln( Error: , SDL_GetError() ); } The program now works from a terminal

Re: @property usage

2014-12-09 Thread Mike Parker via Digitalmars-d-learn
On 12/9/2014 4:31 PM, Nicholas Londey wrote: Does @property ever make sense for a free floating function? I would have thought no but was recently asked to add it if using the function with uniform call syntax. I use it from time-to-time. I assume you think of properties as belonging to

Re: Derelict / SDL error

2014-12-09 Thread Mike Parker via Digitalmars-d-learn
On 12/10/2014 12:19 AM, Paul wrote: I don't fancy introduing another layer of complexity in a debugger at present! I wonder if it's the .bmp that's causing the problem. I can't quite figure how to get Derelict SDL_Image into my project at present (dub doesn't fetch it if I add import

Re: Derelict / SDL error

2014-12-10 Thread Mike Parker via Digitalmars-d-learn
On 12/10/2014 5:59 PM, Paul wrote: Adding that reveals that I need to add SDL_image 2.0 (I didn't know that that wasn't a part of the standard SDL install) so I've compiled that too. I now get the error: Unsupported image format whether I use a png or jpg. int flags = IMG_INIT_PNG |

Re: Derelict / SDL error

2014-12-10 Thread Mike Parker via Digitalmars-d-learn
On 12/11/2014 12:31 AM, Paul wrote: This thread has degenerated into a discussion of the set up of my OS which is miles off topic and should probably be abandoned. Maybe not. The trouble is that others have been able to compile and run the same code without error. Given that you are still

Re: Derelict / SDL error

2014-12-10 Thread Mike Parker via Digitalmars-d-learn
On 12/11/2014 4:17 AM, Paul wrote: On Wednesday, 10 December 2014 at 18:58:15 UTC, Paul wrote: The two machines on which errors occur are a Mint 13 (32 bit) box and an ageing laptop with Lubuntu 14.04. I've followed the same procedures but the 64 bit obviously has the 64 bit dmd compiler.

Re: Wrapping multiple extern (C) declarations in a template

2014-12-13 Thread Mike Parker via Digitalmars-d-learn
On 12/14/2014 4:03 AM, aldanor wrote: However, it wouldn't be possible to retain the same function names since they've been imported to the namespace (it's then also not possible to extern them as private initially since then you won't be able to import/wrap them in a different module). Hence

Re: Derelict SDL2 library not loading on OS X

2014-12-18 Thread Mike Parker via Digitalmars-d-learn
On 12/18/2014 3:29 PM, Joel wrote: I've installed SDL2. Joels-MacBook-Pro:DerelictTest joelcnz$ cat test.d import derelict.sdl2.sdl; int main() { DerelictSDL2.load(); } Joels-MacBook-Pro:DerelictTest joelcnz$ dmd test libDerelictSDL2.a libDerelictUtil.a Joels-MacBook-Pro:DerelictTest

Re: Derelict SDL2 library not loading on OS X

2014-12-18 Thread Mike Parker via Digitalmars-d-learn
On 12/19/2014 9:58 AM, Joel wrote: [snip] derelict.util.exception.SymbolLoadException@derelict/util/exception.d(35): Failed to load symbol SDL_free from shared library /usr/local/lib/libSDL2.dylib OK, the loader is finding libSDL2.dylib in /usr/local/lib where it expects it to be. Your

Re: Derelict SDL2 library not loading on OS X

2014-12-19 Thread Mike Parker via Digitalmars-d-learn
On 12/19/2014 7:35 PM, Joel wrote: Now I get this: Joels-MacBook-Pro:dere joelcnz$ ./app derelict.util.exception.SymbolLoadException@source/derelict/util/exception.d(35): Failed to load symbol SDL_GameControllerAddMapping from shared library /usr/local/lib/libSDL2.dylib OK, it looks like

Re: Derelict SDL2 library not loading on OS X

2014-12-20 Thread Mike Parker via Digitalmars-d-learn
On 12/20/2014 11:46 AM, Joel wrote: To uninstall SDL, do I just wipe the framework, and SDL dylib? Sorry, I can't help you there. I have no idea how things are done on Mac. And I think it depends on how it got there in the first place. You may want to take that question to the SDL mailing

Re: On inheritance and polymorphism in cats and dogs (and other beasts too)

2014-12-21 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 21 December 2014 at 15:05:47 UTC, Mike Parker wrote: // Now do Catty things pickiness = (mother.pickiness + father.pickiness) / 2; Sorry, forgot to change that line when I copy-pasted. Should be: pickiness = (catmom.pickiness + catdad.pickiness) / 2;

Re: On inheritance and polymorphism in cats and dogs (and other beasts too)

2014-12-21 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 21 December 2014 at 10:42:37 UTC, Derix wrote: If you change the mother and father parameters from Beasts to Cats, then you aren't overriding anything -- you are /overloading/. That's where the first two errors were coming from. In order for a subclass method to override a base

Re: How to Declare a new pragma ?

2014-12-21 Thread Mike Parker via Digitalmars-d-learn
On 12/22/2014 9:21 AM, FrankLike wrote: Now ,x64 mainform always have the console window,and the entry is main. could you do it? Thank you. Since 64-bit DMD uses the Microsoft toolchain, you need to pass a parameter on the command line to the MS linker. Linker parameters are

Re: On inheritance and polymorphism in cats and dogs (and other beasts too)

2014-12-21 Thread Mike Parker via Digitalmars-d-learn
On 12/22/2014 1:11 AM, Derix wrote: Yep, I rekon the difference was not clear to me. It still isn't right now, but at least now I know that it exists and I have to look into it. Overriding - a subclass reimplements a method from a base class. The method must have the same number and type of

Re: Need example of usage DerelictPQ

2014-12-24 Thread Mike Parker via Digitalmars-d-learn
On 12/24/2014 8:56 PM, Suliman wrote: Could anybody provide any simple examples of usage DerelictPQ. I do not have experience of C, and I can't understand how to use this driver. I need just basics like connect, select and insert. http://code.dlang.org/packages/derelict-pq thanks!

Re: Need example of usage DerelictPQ

2014-12-24 Thread Mike Parker via Digitalmars-d-learn
On 12/25/2014 11:23 AM, Mike Parker wrote: On 12/24/2014 8:56 PM, Suliman wrote: Could anybody provide any simple examples of usage DerelictPQ. I do not have experience of C, and I can't understand how to use this driver. I need just basics like connect, select and insert.

Re: Need example of usage DerelictPQ

2014-12-25 Thread Mike Parker via Digitalmars-d-learn
On 12/25/2014 3:03 PM, Suliman wrote: DerelictPQ is only a binding to libpq. The only difference is the DerelictPQ.load method. Just follow the libpq documentation. http://www.postgresql.org/docs/9.1/static/libpq.html Actually, Derelict binds to version 9.3, so the proper link should be

Re: Importing a module from another directory

2014-12-27 Thread Mike Parker via Digitalmars-d-learn
On 12/28/2014 3:01 AM, Derix wrote: But of course ! I should have thought of this myself. Subsequent question though : what is the -I option for ? The dmd embedded help states -Ipath where to look for imports so I'd naively think it would work too, but it yields the same error as

Re: Checking C return results against NULL

2014-12-31 Thread Mike Parker via Digitalmars-d-learn
On 12/31/2014 8:29 PM, Rikki Cattermole wrote: On 1/01/2015 12:22 a.m., Laeeth Isharc wrote: Am I missing a more agreeable way to check the return value of a C function against NULL. It's fine if it's a char*, but if it returns a pointer to some kind of struct, one has to go through and

Re: Passing string literals to C

2014-12-31 Thread Mike Parker via Digitalmars-d-learn
On 12/31/2014 8:19 PM, Laeeth Isharc wrote: Argh - no way to edit. What's best practice here? D strings are not null-terminated. === cpling.c char* cpling(char *s) { s[0]='!'; return s; } === dcaller.d extern(C) char* cpling(char* s); void callC() {

Re: cast a C char array - offset ?

2015-02-02 Thread Mike Parker via Digitalmars-d-learn
On 2/2/2015 9:16 PM, irtcupc wrote: The manual section about interfacing from c states that type[] is inter-compatible from C to D, however, I face this strange case: - C declaration: char identifier[64]; - D declaration: char[64] identifier; - the result is only correct if i slice by (-

Re: Allegro 5 in C - installing on OSX

2015-02-03 Thread Mike Parker via Digitalmars-d-learn
On 2/3/2015 5:37 PM, Joel wrote: How do you install Allegro 5 (OSX)? Like, using 'Home Brew'. This really isn't the place for that. At allegro.cc there are Allegro-specific forums [1] and an Allegro wiki info on building/installing, where you can find [2]. [1]

Re: What am I doing Wrong (OpenGL SDL)

2015-02-05 Thread Mike Parker via Digitalmars-d-learn
On 2/5/2015 4:53 PM, Entity325 wrote: On Thursday, 5 February 2015 at 07:23:15 UTC, drug wrote: Look at this https://github.com/drug007/geoviewer/blob/master/src/sdlapp.d I used here SDL and OpenGL and it worked. Ctor of SDLApp creates SDL window with OpenGL context, may be it helps. Tested

Re: Trying to make a TCP server, client connects and disconnects immediately

2015-02-05 Thread Mike Parker via Digitalmars-d-learn
On 2/6/2015 9:50 AM, Gan wrote: On Friday, 6 February 2015 at 00:35:12 UTC, Adam D. Ruppe wrote: On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote: Or am I misunderstanding the receive function? Does it send whole messages or just message chunks? It sends as much as it can when you call

Re: strange work of GC

2015-02-07 Thread Mike Parker via Digitalmars-d-learn
On 2/8/2015 4:32 AM, Andrey Derzhavin wrote: Why do you want to use destroy? The destroy method always calls a dtor of the objects, where I can destroy some object's variables in that order that I need, I think. And this is very good for me, because I have a full control of the object's

Re: strange work of GC

2015-02-07 Thread Mike Parker via Digitalmars-d-learn
On 2/8/2015 11:32 AM, FG wrote: On 2015-02-08 at 01:20, Mike Parker wrote: In your case, forget destructors and the destroy method. Just implement a common method on all of your objects that need cleanup (perhaps name it 'terminate') and call that. This gives you the deterministic destruction

Re: import conflicts

2015-01-18 Thread Mike Parker via Digitalmars-d-learn
On 1/19/2015 4:37 AM, AndyC wrote: On Sunday, 18 January 2015 at 19:20:34 UTC, Vlad Levenfeld wrote: I get this all the time with std.array.array (I use my own array implementations, but phobos' array seems to secretly creep in everywhere). I think its got to do with that private import

Re: simple assignment statement compiles but becomes a run time error

2015-01-18 Thread Mike Parker via Digitalmars-d-learn
On 1/19/2015 10:44 AM, WhatMeWorry wrote: On Sunday, 18 January 2015 at 20:07:25 UTC, weaselcat wrote: On Sunday, 18 January 2015 at 19:51:02 UTC, WhatMeWorry wrote: On Sunday, 18 January 2015 at 19:42:33 UTC, WhatMeWorry wrote: I've got a OpenGL function returning a pointer // const

Re: Bug on Posix IPC_STAT. Wrong number of attachments

2015-01-19 Thread Mike Parker via Digitalmars-d-learn
On 1/19/2015 2:35 PM, tcak wrote: On Monday, 19 January 2015 at 04:18:47 UTC, tcak wrote: On Sunday, 18 January 2015 at 22:25:39 UTC, anonymous wrote: On Sunday, 18 January 2015 at 18:07:05 UTC, tcak wrote: After these, it works perfectly. I hope this can be fixed in next version. Please

Re: redirecting the unittests error output

2015-01-15 Thread Mike Parker via Digitalmars-d-learn
On 1/15/2015 4:32 AM, ref2401 wrote: Unfortunately i'm new to using shells. I use standard windows cmd. Here is my script: dmd main.d -debug -unittest -wi if %errorLevel% equ 0 ( start main.exe ) else ( echo --- Building failed! --- pause ) I wrote start main.exe 2 errorFile

Re: redirecting the unittests error output

2015-01-15 Thread Mike Parker via Digitalmars-d-learn
[1] http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true [2] https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true

Re: Comparing function pointers

2015-02-12 Thread Mike Parker via Digitalmars-d-learn
On 2/12/2015 3:40 AM, Freddy wrote: import std.stdio; auto test1(){ void testFunc(){ } return testFunc; } auto test2(){ uint a; void testFunc(){ a=1; } return testFunc; } void main(){ writeln(test1()==test1());//true

Re: GC has a barbaric destroyng model, I think

2015-02-12 Thread Mike Parker via Digitalmars-d-learn
On 2/12/2015 6:09 PM, weaselcat wrote: On Thursday, 12 February 2015 at 08:33:35 UTC, Kagamin wrote: Truth be told, D has no guideline for deterministic destruction of managed resources. +1 don't complain about people wondering why class destructors don't work when there's no _real_ way to

Re: GC has a barbaric destroyng model, I think

2015-02-12 Thread Mike Parker via Digitalmars-d-learn
On 2/12/2015 6:42 AM, ketmar wrote: this problem has very easy solition: we should stop calling class dtors destructors, and rename them to finalizers. Absolutely. So many people coming from C++ see destructor and want to use them as they did in C++. How often do we see people coming on

Re: Derelict OpenGL basic program does not work but OpenGL does not say anything is wrong?

2015-02-13 Thread Mike Parker via Digitalmars-d-learn
On 2/13/2015 6:14 PM, Mike Parker wrote: On 2/13/2015 12:46 PM, Bennet wrote: I've begun writing some basic OpenGL code using DerelictGL3 but I've hit a wall. I've managed to open a window (with DerelictSDL2) and call basic OpenGL functions such as glClear(). Still I can not get a basic

Re: Derelict OpenGL basic program does not work but OpenGL does not say anything is wrong?

2015-02-13 Thread Mike Parker via Digitalmars-d-learn
On 2/13/2015 12:46 PM, Bennet wrote: I've begun writing some basic OpenGL code using DerelictGL3 but I've hit a wall. I've managed to open a window (with DerelictSDL2) and call basic OpenGL functions such as glClear(). Still I can not get a basic triangle up and running. glError() does not

Re: Is this possible in D?

2015-02-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 February 2015 at 08:24:08 UTC, Jonathan Marler wrote: I am having a heck of a time trying to figure out how to do this. How do I change the attributes of a function based on the version without copying the function body? For example: version(StaticVersion) { static void

Re: Is this possible in D?

2015-02-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 February 2015 at 10:17:47 UTC, Dicebot wrote: Most practical approach I am currently aware of is wrapping actual implementation (in most restrictive version): I really like mixins for this sort of thing. ``` enum signature = void longFunction(); version( Static ) enum

Re: Is this possible in D?

2015-02-19 Thread Mike Parker via Digitalmars-d-learn
On 2/20/2015 1:06 AM, tcak wrote: @OP: By using a token string (q{}) for funcBody rather than a WYSIWYG string (r or ``), you can still get syntax highlighting in your editor. Based on your example, bye bye readibility. It is like writing rocket taking off procedures. People are complaining

  1   2   3   4   5   6   7   8   9   10   >