Using GD with D

[email protected] (Alexander Brock)
Newsgroups php.gd.devel
Message-ID <[email protected]>
Hello,

I'm trying to use GD in a D program,
but I always get an error when I try to use gdImagePng:
"Error: Access Violation"

I use WinXP, Digital Mars D Compiler 1.007
(http://www.digitalmars.com/d/), D-Bindings from
http://www.algonet.se/~afb/d/gd.zip
and the latest Windows-GD-DLL.

I can compile the program:
dmd -v example.d bgd.lib

bgd.lib was generated by implib which is included in DMD.

Here's the code of example.d:

import std.stdio;
import std.stream;
import gd.gd;
import gd.gd_io;
import gd.gdfx;

void main() {
  gdImagePtr result;
  _iobuf* output;

  result = gdImageCreateTrueColor(10, 10);

  gdImageSetPixel(result, 5, 5, gdImageColorAllocate(result, 150, 150, 
150));

  output = fopen("rect.png", "wb");
  writefln("1");

  gdImagePng(result, output);
  writefln("2");

  fclose(output);
  writefln("3");
}

Did I do something wrong?
Any suggestions how to solve the problem?

Alexander
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.