Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

Spatial Modeler SDI: anyone used GDAL?

[ Edited ]

Hi,

 

I'm trying to write a Spatial Modeler component using the gdal library that's shipped with SM SDK, however I can't get it to work. Has anyone done this successfully?

 

C/C++ include directories: $(SpatialModelerSDKHome)\usr\include\$(Platform)$(Configuration);%(AdditionalIncludeDirectories)

Linker Additional Library Directories: $(SpatialModelerSDKHome)\usr\lib\$(Platform)$(Configuration)

Linker Input: Additional Dependencties: gdal_id.lib; etc...

 

 

include <gdal/gdal.h>
#include <gdal/gdal_priv.h>
#include <gdal/ogr_api.h>
#include <gdal/ogrsf_frmts/ogrsf_frmts.h>

....

if( (dataset = (GDALDataset*)GDALOpenEx(sUrl.c_str(), GDAL_OF_VECTOR|GDAL_OF_READONLY, NULL, NULL, NULL)) == NULL) {
			SetErrorMessage(L"Error opening " + url);
		}

 

When I  compile I get 2 warnings:

 

d:\program files\hexagon\spatial modeler sdk 2018\usr\include\win32debug\gdal\gdal_priv.h(664): warning C4251: 'GDALColorTable::aoEntries' : class 'std::vector<GDALColorEntry,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'GDALColorTable'
1>          with
1>          [
1>              _Ty=GDALColorEntry
1>          ]
1>d:\program files\hexagon\spatial modeler sdk 2018\usr\include\win32debug\gdal\gdal_priv.h(1144): warning C4251: 'GDALDriverManager::oMapNameToDrivers' : class 'std::map<CPLString,GDALDriver *,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'GDALDriverManager'
1>          with
1>          [
1>              _Kty=CPLString
1>  ,            _Ty=GDALDriver *
1>          ]

 

When I run my component I get an error indicating corrupt memory. When I comment out the GDALOpenEx statement it works fine. So this line is the culprit.

 

What I understand from the warnings it seems that the GDAL code is not suited to create a dll?

 

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.