Using GFL SDK with Borland C++ Builder

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

lechoo
Posts: 5
Joined: Tue Feb 22, 2005 2:20 pm

Using GFL SDK with Borland C++ Builder

Post by lechoo »

Hi,
in want to use GFL SDK with Borland C++ Builder 6 however I have a problem. When I compile my project I get these linker errors:

[Linker Error] Unresolved external 'GFLW_FILE_INFORMATION::~GFLW_FILE_INFORMATION()' referenced from C:\TEMP\GFL\UNIT1.OBJ
[Linker Error] Unresolved external 'GFLW_FILE_INFORMATION::GFLW_FILE_INFORMATION()' referenced from C:\TEMP\GFL\UNIT1.OBJ

I have read this post: http://newsgroup.xnview.com/viewtopic.php?t=967 and performed all actions described there and still no luck. Maybe I'm not doing this right.

All I have in my code (that is GFL related) is:
GFLW_FILE_INFORMATION info;
When this is commented everything compiles and works.

Can someone help me with this or point me to some solution?
Thanks.
User avatar
xnview
Author of XnView
Posts: 44470
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Using GFL SDK with Borland C++ Builder

Post by xnview »

lechoo wrote:Hi,
in want to use GFL SDK with Borland C++ Builder 6 however I have a problem. When I compile my project I get these linker errors:

[Linker Error] Unresolved external 'GFLW_FILE_INFORMATION::~GFLW_FILE_INFORMATION()' referenced from C:\TEMP\GFL\UNIT1.OBJ
[Linker Error] Unresolved external 'GFLW_FILE_INFORMATION::GFLW_FILE_INFORMATION()' referenced from C:\TEMP\GFL\UNIT1.OBJ

I have read this post: http://newsgroup.xnview.com/viewtopic.php?t=967 and performed all actions described there and still no luck. Maybe I'm not doing this right.

All I have in my code (that is GFL related) is:
GFLW_FILE_INFORMATION info;
When this is commented everything compiles and works.

Can someone help me with this or point me to some solution?
Thanks.
Do you include the C++ wrapper?
Pierre.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm

Post by MaierMan »

When using the c++ wrapper (in gflsdk\c++) you'll need to add the corresponding .cpp files as well, eg. using "Project > Add to Project"

The reason is:
The wrapper code itself is not precompiled and linked into the library (dll).
Thus the linker throws those error since the code you're using is simply not there ;)

(code linked into the dll properly wouldn't anyway since visualc++ and BCB (just to name the common Win32 compilers) mangle class names in a different style).
lechoo
Posts: 5
Joined: Tue Feb 22, 2005 2:20 pm

Post by lechoo »

Thanks guys, that was the problem. Including .cpp files from gflsdk\c++ helped.
However now I have another problem. I have completly new project with this code executed with button pressed:

Code: Select all

GFLW_LIBRARY::Initialise();
AnsiString ver = gflGetVersion();

if (OpenDialog1->Execute())
        {
        GFLW_FILE_INFORMATION info;
        info.GetFromFile(OpenDialog1->FileName.c_str(),-1);
        }
GFLW_LIBRARY::Exit();
It gives me access violation "Read of address FFFFFFFF" on GetFromFile line. Initialisation is OK, it returns 0. gflGetVersion returns correct version (2.20).

I have created libraries with implib using parameters -a -c (b_libgfl220.lib and b_libgfle220.lib) and added them to project.
I also have included gflw.h and added gflsdk\c++ and gflsdk\include to include paths. gflsdk\lib is added to library path.

Any idea what's wrong this time?
thanks in advance
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm

Post by MaierMan »

D'OH

I almost forgot what I did.
(What reminds me that I wanted to talk to Pierre about that)

I got my own libs with -c switch.
But I also modified the headers in order to get them working perfectly with Borland CBuilder who seem to ignore some defines.
(In this case WIN32 define)....
Furthermore Borland "adjusted" Win PSDK for use with Compiler.
And they did a really bad job here IMO ROFL
I usually stumble over a lot of error when I directly program API without using the Delphi-implemented VCL wrappers.

Just in the case you're interested in "my versions":
Here is a download http://celebnamer.celebworld.ws/xnview/ ... orland.rar

Using them usually works fine.
lechoo
Posts: 5
Joined: Tue Feb 22, 2005 2:20 pm

Post by lechoo »

Switching your libs with mine solved the problem. Later I tried again to use implib but this time only with -c option and looks like this is the solution because this also worked fine.

Many, many thanks for your help.

I didn't do much testing yet but i think i have found possible bug. When I read resolution of CRW from my Canon EOS 300D i get 2048x1360 when this image is 3088x2056.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm

Post by MaierMan »

lechoo wrote:...
I didn't do much testing yet but i think i have found possible bug. When I read resolution of CRW from my Canon EOS 300D i get 2048x1360 when this image is 3088x2056.
Then I would recommend you test a little deeper and report the bug (if you find it is indeed one) in another thread outlining the problem so that Pierre may look into it ;)