Shared library string safety?

TheFlyingFiddle theflyingfiddle at gmail.com
Tue Jan 14 01:27:39 PST 2014


On Tuesday, 14 January 2014 at 07:44:21 UTC, Mineko wrote:
> I see, I'll have to look more into that, on a slightly 
> unrelated note, any idea what's going on with glfwCreateWindow, 
> it keeps wanting to be null while it's supposed to be an 
> adddress.
>
> this.get = glfwCreateWindow(settings.width, settings.height,
> 	toStringz(settings.title), this.monitor, this.share);
> 			
> writeln(this.get);
>

glfwCreateWindow returns a null ptr if something is wrong with 
it's parameters or os driver or anything it can detect really. To 
get error information you can use glfwSetErrorCallback with a 
custom function and handle the errors with it.

Something like this:

extern(C) void errorFunc(int error_code, const(char)* 
errorMessage)
{
   //Do something here like wrilteln.
}

void main()
{
    //Load libs and setup stuff.
    glfwSetErrorCallback(&errorFunc);

    //Now anything that gives an error will forward it to
    //errorFunc.
}

> That writeln will give me null, is it related to all this stuff?
I doubt it.


More information about the Digitalmars-d-learn mailing list