- built IM 6.6.3 in Visual Studio 6. (VC++6.0)
- checked static Multi-threaded runtimes
- unchecked Generate Visual Studio 7 format
- clicked edit "magick-config.h"
saved this change:
#define MAGICKCORE_QUANTUM_DEPTH 8
-> generated VisualStaticMT,
There were many more errors than when I last used the same process to build 6.5.9:
/// COMPILE ERRORS ////////////////////
When I tried to build the libraries in debug and release I got many conversion errors which I cast away by adding this cast (__int64)
Following are the lines that showed the error, followed by the modified line with cast
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\txt.c(664) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64) GetQuantumRange(image->depth),colorspace);
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\psd.c(866) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
" reading image resource blocks - %.20g bytes",(double) (__int64)length)
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\psd.c(1047) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
layer_info.mask.height,(double) (__int64)length-16);
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\psd.c(1064) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64) length);
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\psd.c(1133) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64)(size-combinedlength));
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\pnm.c(1625) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64) GetQuantumRange(image->depth));
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\pnm.c(1857) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64) GetQuantumRange(image->depth));
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\pnm.c(1940) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64) GetQuantumRange(image->depth));
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\coders\debug.c(217) : error C2520: conversion from unsigned __int64 to double not implemented, use signed
(__int64) GetQuantumRange(image->depth),colorspace);
MagickCore module static interface
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\magick\resource.c(682) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64) resource_info.time_limit);
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\magick\resource.c(689) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\magick\resource.c(689) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(double) (__int64)resource_info.thread_limit,time_limit);
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\magick\property.c(2621) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
(__int64) image->extent);
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\magick\effect.c(3808) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
factor,(double) (__int64)GetBlobSize(thumbnail));
/// LINK ERRORS //////////////////////////////////////
When that was all done, we got the linker errors (none in 6.5.9). Specifically,
when trying to link, got complaints about missing sqrtf, vsnprintf, and InitializeCriticalSectionAndSpinCount
//FIX: modified sempaphore.c to get rid of InitializeCriticalSectionAndSpinCount thus:
#elif defined(MAGICKCORE_HAVE_WINTHREADS)
{
//int status =1;
InitializeCriticalSection(&semaphore_info->mutex);
//if (status == 0)
//{
// errno=status;
// ThrowFatalException(ResourceLimitFatalError, "UnableToInitializeSemaphore");
//}
}
#endif
///build could not find sqrtf, hidden by a problem in
C:\npsDev\CVS_Src\Brokers\ThirdPartyLib\Windows\ImageMagick-6.6.3\lcms\src\lcms2_internal.h
// BorlandC 5.5 is broken on that
#ifdef __BORLANDC__
#define sinf(x) (float)sin((float)x)
#define sqrtf(x) (float)sqrt((float)x)
#endif
/// in windows build, I guess __BORLANDC__ is undefined, so this call to sqrtf was not found...
// Euclidean distance between two vectors of n elements each one
static
cmsFloat32Number EuclideanDistance(cmsFloat32Number a[], cmsFloat32Number b[], int n)
{
cmsFloat32Number sum = 0;
int i;
for (i=0; i < n; i++)
{
cmsFloat32Number dif = b - a;
sum += dif * dif;
}
//return sqrtf(sum);
return (float)(sqrt((float)sum)); //FIXED BY DEFINING CONVERSIONS ON THE SPOT
}
//////////////////////////////////////////////////
/// vsnprintf is OK everywhere else, but was not OK here, so I appended the _ to get _vsnprintf
/// NOTE:builds OK as vsnprintf in 6.5.9
int
wmf_stream_printf (wmfAPI* API,wmfStream* stream,char* format,...)
{ int length;
va_list argp;
va_start (argp,format);
for (;;)
{
length = _vsnprintf (API->string_buffer.buffer,API->string_buffer.length,format,argp);
if ((length >= 0) && (length < (API->string_buffer.length - 1))) break; /* i.e., success */
if (wmf_strbuf_grow (API) == 0) break; /* i.e., probably a memory failure */
}
va_end (argp);
if (ERR (API))
{
WMF_DEBUG (API,"bailing...");
return (0);
}
stream->sputs (API->string_buffer.buffer,stream->context);
return (length);
}