[gdal-dev] GDAL Compilation issues

lambesh lambesh at yahoo.com
Wed Mar 11 05:17:29 PDT 2015


Hi,

I am new to the world of GDAL. One of my applications is currently using
GDAL111.dll, I managed to build both 32 and 64bit of GDAL. I have noticed
that 64bit GDAL has exported functions without STDCALL conventions (i.e,
without _GDALXXX at NN), accordingly, I modified my code and the 64 bit version
of my application is working fine.

Now, coming to my 32bit version of the application, even though I have
commented STDCALL=YES in nmake.opt file and added the following:
OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MD /EHsc /Ox
/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
*-DCPL_DISABLE_STDCALL*
, my application is complaining about unresolved external symbols during
linking:

error LNK2001: unresolved external symbol "public: *virtual enum CPLErr*
__thiscall GDALRasterBand::GetDefaultHistogram(double *,double *,int *,int *
*,int,int (__stdcall*)(double,char const *,void *),void *)"
(?GetDefaultHistogram at GDALRasterBand@@UAE?AW4CPLErr@@PAN0PAHPAPAHHP6GHNPBDPAX at Z4@Z)
GLSGLibU.lib(GLSGWin.obj) : 

error LNK2019: unresolved external symbol *_GDALClose at 4* referenced in
function "public: virtual bool __thiscall
CGLSGWin::SaveBitmapFile(int,int,int,int,class ATL::CStringT<wchar_t,class
StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >,class
ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class
ATL::ChTraitsCRT<wchar_t> > >,bool,struct D3DXCOLOR)"
(?SaveBitmapFile at CGLSGWin@@UAE_NHHHHV?$CStringT at _WV?$StrTraitMFC_DLL at _WV?$ChTraitsCRT at _W@ATL@@@@@ATL@@0_NUD3DXCOLOR@@@Z)
GLSGLibU.lib(GLSGWin.obj) : 

error LNK2019: unresolved external symbol "public: class GDALDataset *
__thiscall GDALDriver::CreateCopy(char const *,class GDALDataset *,int,char
* *,int (__stdcall*)(double,char const *,void *),void *)"
(?CreateCopy at GDALDriver@@QAEPAVGDALDataset@@PBDPAV2 at HPAPADP6GHN0PAX@Z3 at Z)
referenced in function "public: virtual bool __thiscall
CGLSGWin::SaveBitmapFile(int,int,int,int,class ATL::CStringT<wchar_t,class
StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >,class
ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class
ATL::ChTraitsCRT<wchar_t> > >,bool,struct D3DXCOLOR)"
(?SaveBitmapFile at CGLSGWin@@UAE_NHHHHV?$CStringT at _WV?$StrTraitMFC_DLL at _WV?$ChTraitsCRT at _W@ATL@@@@@ATL@@0_NUD3DXCOLOR@@@Z)
GLSGLibU.lib(GLSGWin.obj) : 

error LNK2019: unresolved external symbol *_GDALAllRegister at 0* ...

I have also verified the exports from 32bit gdal111.dll and the functions
are similar to that of 64bit.

I am using the following in another library:
m_hGDALDLLInstance = LoadLibrary(_T("gdal111.dll"));

        if ( m_hGDALDLLInstance == NULL )
        {
            DWORD dWord = GetLastError();
            return false;
        }

        GDALAllRegister = (pfnGDALAllRegister)GetProcAddress(
m_hGDALDLLInstance, "GDALAllRegister");
        GDALOpen = (pfnGDALOpen)GetProcAddress( m_hGDALDLLInstance,
"GDALOpen");
        GDALClose = (pfnGDALClose)GetProcAddress( m_hGDALDLLInstance,
"GDALClose");
        GDALGetDatasetDriver = (pfnGDALGetDatasetDriver)GetProcAddress(
m_hGDALDLLInstance, "GDALGetDatasetDriver");
        GDALGetDriverShortName = (pfnGDALGetDriverShortName)GetProcAddress(
m_hGDALDLLInstance, "GDALGetDriverShortName");
        GDALGetProjectionRef = (pfnGDALGetProjectionRef)GetProcAddress(
m_hGDALDLLInstance, "GDALGetProjectionRef");
        GDALGetRasterXSize = (pfnGDALGetRasterXSize)GetProcAddress(
m_hGDALDLLInstance, "GDALGetRasterXSize");
        GDALGetRasterYSize = (pfnGDALGetRasterYSize)GetProcAddress(
m_hGDALDLLInstance, "GDALGetRasterYSize");
        GDALGetRasterCount = (pfnGDALGetRasterCount)GetProcAddress(
m_hGDALDLLInstance, "GDALGetRasterCount");
        GDALGetRasterBand = (pfnGDALGetRasterBand)GetProcAddress(
m_hGDALDLLInstance, "GDALGetRasterBand");
        GDALGetRasterBandXSize = (pfnGDALGetRasterBandXSize)GetProcAddress(
m_hGDALDLLInstance, "GDALGetRasterBandXSize");
        GDALGetRasterBandYSize = (pfnGDALGetRasterBandYSize)GetProcAddress(
m_hGDALDLLInstance, "GDALGetRasterBandYSize");
        GDALGetRasterNoDataValue =
(pfnGDALGetRasterNoDataValue)GetProcAddress( m_hGDALDLLInstance,
"GDALGetRasterNoDataValue");
        GDALGetRasterDataType = (pfnGDALGetRasterDataType)GetProcAddress(
m_hGDALDLLInstance, "GDALGetRasterDataType");
        GDALGetRasterCategoryNames =
(pfnGDALGetRasterCategoryNames)GetProcAddress( m_hGDALDLLInstance,
"GDALGetRasterCategoryNames");
        GDALGetRasterColorInterpretation =
(pfnGDALGetRasterColorInterpretation)GetProcAddress( m_hGDALDLLInstance,
"GDALGetRasterColorInterpretation");
        GDALGetGeoTransform = (pfnGDALGetGeoTransform)GetProcAddress(
m_hGDALDLLInstance, "GDALGetGeoTransform");
        GDALRasterIO = (pfnGDALRasterIO)GetProcAddress( m_hGDALDLLInstance,
"GDALRasterIO");
        GDALGetRasterColorTable =
(pfnGDALGetRasterColorTable)GetProcAddress( m_hGDALDLLInstance,
"GDALGetRasterColorTable");
        GDALGetColorEntryCount = (pfnGDALGetColorEntryCount)GetProcAddress(
m_hGDALDLLInstance, "GDALGetColorEntryCount");
        GDALGetColorEntryAsRGB = (pfnGDALGetColorEntryAsRGB)GetProcAddress(
m_hGDALDLLInstance, "GDALGetColorEntryAsRGB");
        GDALDatasetRasterIO = (pfnGDALDatasetRasterIO)GetProcAddress(
m_hGDALDLLInstance, "GDALDatasetRasterIO");

Any help in this regard would really appreciated as I don't want to rewrite
the above code for 32bit by adding _ in front of every function




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GDAL-Compilation-issues-tp5192779.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list