PDA

View Full Version : Using 3rd party DLL: undefined symbol



feraudyh
4th July 2018, 10:31
Hello,
I'm trying to use an SDK for a fingerprint scanner. The SDK has the files IBScanUltimate.lib and IBScanUltimate.dll. Dumpbin.exe and dependency walker show up the same "symbols" or exported functions. There is a sample Visual Studio 2008 project that uses these files.
The installation of the SDK is designed for a 64 bit OS.
On Dependency Walker opening IBScanUltimate.dll I can see a table that indicates that the function IBSU_GetSDKVersion has ordinal 1 and hint 70, as well as corresponding information for many other functions. I'm not quite sure what this means. I'm guessing that the ordinal is an index to a table to get access to the function. As for the hint I have no idea.
Now I'd like to use this SDK in an older QtCreator with MinGW32, but I have linking problems.
To make things simple here is the first test project file content:

QT += core
QT -= gui
TARGET = Kojak1
CONFIG += console
CONFIG -= app_bundle
KOJAKDIR = "C:/Program Files/Integrated Biometrics/IBScanUltimateSDK_x64"
TEMPLATE = app
INCLUDEPATH += $$KOJAKDIR/Include
SOURCES += main.cpp
LIBS +=-L$$KOJAKDIR/lib/ -lIBScanUltimate
and here is the content of the file main.cpp


#include <QCoreApplication>
#include "stdio.h"
#include <windows.h>
#include "IBScanUltimateApi.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

IBSU_SdkVersion sdk_version;
IBSU_GetSDKVersion(&sdk_version);
printf("%s %s",sdk_version.File,sdk_version.Product);
return a.exec();
}


The building of the project stops at the linking stage with the following error message

D:\devt\QTProjects\Kojak1\main.cpp:-1: error: undefined reference to `IBSU_GetSDKVersion@4'
My first question is what is the @4 doing there and where did the number 4 come from? My guess is that it was supposed to be the ordinal, but clearly something went badly wrong.
My second question is: is there any way I can get this project to work? I have come up against this kind of situation before and sometimes the link passed and sometimes it did not.
Once when the link did not go through I resorted to dynamically loading the functions by #include <Qlibrary> and a call like this
m_library = new QLibrary( dllLibPath , this);
and then calls to
the_function_pointer = m_library->resolve(the_function_name)
However this is painful
I'm guessing that the culprit may be MinGW32 and that I might have to recompile the whole Qt installation with another compiler, like the one that came with Visual Studio Community edition
2017, or perhaps MingW64. Or maybe I should just install the 32 bit version of the SDK (with a minor performance hit?)