Using GD with D
| From: | Alexander Brock | Date: | Sat, 24 Feb 2007 19:10:51 +0000 |
| Subject: | Using GD with D | ||
| Groups: | php.gd.devel | ||
| Request: | Send a blank email to php-gd-devel+get-110@lists.php.net to get a copy of this message | ||
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