Re: [GD-DEVEL] Problems using the .dll

[email protected] (Pierre)
Newsgroups php.gd.devel
Message-ID <[email protected]>
Hi Nuno,

On 4/17/07, Nuno Centeio <[email protected]> wrote:
> Hi!
>
> I'm new to GD and I want to test it.
>
> I've downloaded gd-2.0.34-win32.zip so that I can use it on my project.
> I've created a new project on Visual Studio 2005.
>
> Add the gd include/ directory to my project and also the lib/ directory.
>
> It all compiles and links fine.
>
>
> When I'm running the application I get the error:
>
> (...)
> 'Teste2.exe': Loaded 'E:\MyProjects\Teste2\debug\bgd.dll', Binary was
> not built with debug information.
> (...)
> First-chance exception at 0x7c918fea in Teste2.exe: 0xC0000005: Access
> violation writing location 0x00000010.
> Unhandled exception at 0x7c918fea in Teste2.exe: 0xC0000005: Access
> violation writing location 0x00000010.
>
>
> This exception happens somewhere in this line:
>   gdImagePng(im, pngout);

Do you use VC6 or a later version? These binaries are built using VC6,
it may cause troubles if they are used with a different runtime
(msvcrt).

> Anyone can give me a hint on this?
> Or how can I compile the .dll myself?

It is relatively simple. There is two solutions, one using the
specific windows Makefile and one using cmake (works on all
platform/compiler). I will post a tutorial about cmake and windows
later this week in our wiki.

For both solutions create a directory structure like:
c:\gd_build
 |_gd_deps << comes from gd_build_win32_deps.zip)
  |_include
  |_lib
 |_libgd << come from the source package or CVS

To build using the Makefile:
 . Fetch gd_build_win32_deps.zip from www.libgd.org/releases/extras/
 . Open a SDK (vc menu) console
 . cd c:\gd_build\libgd\windows
 . Fetch the Makefile from CVS (until 2.0.35 is out):
   http://cvs.php.net/viewvc.cgi/gd/libgd/windows/
   Or set your environment variables to add gd_build\gd_deps to your
paths (lib and include)
 . Edit the Makefile to change the path (top)
 . run nmake

Using CMake (Use CVS until 2.0.35 is out):
- Install CMake (see http://www.cmake.org)
- Open a SDK console and go to  c:\gd_build\libgd\
- Run: "cmakesetup" or "c:\path\to\cmakesetup" if you did not add it
to your path
  You can also call cmakesetup from the menu
- Select the correct source directory (c:\gd_build\libgd)
- Select the place where you like to build gd (I use c:\gd_build\libgd\bld)
- Click Configure, the first time you click it it will ask you which
kind of project
  you like to have. I use the nmake Makefile but you can select VC
project files.
- in the console, from the  c:\gd_build\libgd\bld directory, run nmake

The CMake procedure sounds complex but it is in fact a piece of cake
to use it. It works with ming, visual studio or ICC on windows and
with nearly all unix-like platforms.

For both platforms, it is important to correctly use MT or MD.

Please let us know if it solves your problem.

Cheers,
--Pierre
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.