Pelles C forum

C language => Beginner questions => Topic started by: Mario on May 31, 2007, 07:57:03 PM

Title: Help with LibGD
Post by: Mario on May 31, 2007, 07:57:03 PM
How to use LibGD (http://www.libgd.org (http://www.libgd.org)) with PellesC?
I do not succeed in getting the lib from the Dll, can you help me?
Thx
Mario
Title: Re: Help with LibGD
Post by: koala on June 13, 2007, 12:03:59 PM

I have the same problem, some solution?

(Compilation run fine, but on run some gd functions like gdImageJpeg cause segmentation fault)

Meanwhile i use PellesC to write code and mingw to compile.

Thank You

Title: Re: Help with LibGD
Post by: frankie on June 13, 2007, 03:57:21 PM
Problem due to the wrong calling convention.
Define the symbol 'WIN32' in your projects.
From ide menu project->project_options->compiler add 'WIN32' in the symbol's define box.
From command line use switch '/D' to define symbol 'WIN32'.
Title: Re: Help with LibGD
Post by: koala on June 13, 2007, 05:14:08 PM
I tried, but i have same problem.

On menu project->project_options->compiler  at the bottom, now appears:

Comand line options: (CCFLAGS)
 -Tx86-coff -Ot -W1 -Gz -Ze -DWIN32

is all right?

Thank You
Title: Re: Help with LibGD
Post by: frankie on June 13, 2007, 07:58:36 PM
Ok the problem is the incompatibility of PellesC and M$ file I/O approach.
To use the precompiled dll you have to omit the default libraries and link the msvcrt.lib instead.
Please look at the attached sample.
Title: Re: Help with LibGD
Post by: koala on June 13, 2007, 08:57:02 PM

It's working fine!!!!


Thank You