Bah.mod Freeimage.mod

Started by _PJ_, September 22, 2024, 18:25:51

Previous topic - Next topic

Baggey

I have No idea what you guys are talking about. LOL or doing but if it improves BlitzMax then thats 8)

Kindest Regards Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on Acer 24" . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

_PJ_

Quote from: Baggey on October 15, 2024, 19:22:13I have No idea what you guys are talking about. LOL or doing but if it improves BlitzMax then thats 8)

Kindest Regards Baggey

From what little I understand, it seems that between the "Freeimage library" which is itself a separate opensource project - being somewhat outdated - and the C++ standards being updated --- has left the Freeimage.mod module failing to compile due to what it seems is a need to explicitly cast char types as signed/unsigned

_PJ_

This feels like I've started down a bit of a deep rabbit-hole!




I went through the files of Freeimage.mod and made the following changes::
../freeimageglue.cpp
Replaced instances as per suggestion: " freeimageglue.cpp to 'char*' by searching every instance of 'bbStringToCString' and replacing it with '(char *)bbStringToCString'. "
../source.bmx
Commented out Line 24: Import "source_openexr.bmx"
../source_openexr.bmx
renamed to "openexr.bmx_BAK"
../src/OpenEXR
   renamed to "OpenEXR_BAK"
../src/FreeImage/Plugin.cpp
   commented out line268:  s_plugins->AddNode(InitEXR);
../src/FreeImage/ PluginEXR.cpp
  renamed to "PluginEXR.cpp _BAK"
../src/FreeImage/ PluginTIFF.cpp
 commented out line42: #include "../OpenEXR/Half/half.h"
 commented out lines 2196 - 2211:
 
[//convert from half (16-bit) to float (32-bit)
//!!! use OpenEXR half helper class
 half half_value;
 for (uint32 l = 0; l < nrow; l++) {
 WORD *src_pixel = (WORD*)(buf + l * src_line);
 float *dst_pixel = (float*)bits;
 for(tmsize_t x = 0; x < (tmsize_t)(src_line / sizeof(WORD)); x++) {
 half_value.setBits(src_pixel
[ x ]);
);
 dst_pixel [ x ] = half_value;
 }
 bits -= dst_pitch;
 }


__________________________________________________________________________

I then ran a "Build" and it reported success. No errors whatseover and completed 100%

__________________________________________________________________________

However, when attempting to atually compile source example that calls "Import bah.freeimage" compilation fails due to the following::


QuoteC:/Program Files/BlitzMax/MinGW32x64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Program Files/BlitzMax/mod/archive.mod/zlib.mod/zlib.debug.win32.x64.a(azz_zutil.c.debug.win32.x64.o):C:/Program Files/BlitzMax/mod/archive.mod/zlib.mod/zlib/zutil.c:13: multiple definition of `z_errmsg'; C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/freeimage.debug.win32.x64.a(fsZ_zutil.c.debug.win32.x64.o):C:/Program Files/BlitzMax/mod/bah.mod/freeimage.mod/src/ZLib/zutil.c:13: first defined here
collect2.exe: error: ld returned 1 exit status
Build Error: Failed to link F:/bb/BMax64/Misc/DDS Write Test/DDS Test.debug.exe
Process complete
With a popup notification stating "Compile Error. First defined here"
Which I think is saying that there is a variable called "z_errmsg" which is defined in both "archive.mod" and "freeimage.mod"

Given that a lot of image formats rely on compression, it is likely that the same compression library is incorporated into parts of freeimage.mod and archive.mod --- for example, both may make use of LZma compression etc.

So I am a little bit stuck once again...