AnsweredAssumed Answered

SE_sql_construct_alloc returns invalid SE_SQL_CONSTRUCT struct from ArcSDK10.2  C API

Question asked by youmei_ge on Jan 15, 2015
Latest reply on Feb 17, 2015 by youmei_ge

Hi all,


We have an application using ArcSDE SDK C API to translate our data to ArcGIS SDE geodatabase.

Our application runs OK with ArcSDE SDK 10.0 for years without problems.


When we re-build the same code using ArcSDE SDK 10.2 (64 bits),it is found that the structure allocated by

SE_sql_construct_alloc(1, &sqlc)  can not be used. The problem can be reproduced by the code below.


After further investigation,I have noticed that it is the complier option /Zp1 caused the invalid
structure returned.
The code below works ok if it is compiled with /Zp8 or /Zp16. It will crash if it is complied with  /Zp1.


This indicates ArcSDK SDE 10.2 requies 8 or 16 bytes as the Struct member Alignment, however in
our application we requires 1 byte as the Struct member Alignment.


Can anyone suggest how we solves the conflict?


We don’t have the problem with ArcSDE SDK 10.0.


Any help is much appreciated.



int main(int argc, char* argv[])


       long        rc;

       SE_SQL_CONSTRUCT    *sqlc;

       SE_CONNECTION connection;


      rc = SE_connection_create(NULL, "sde:sqlserver:sql_instance", "SDI", NULL, NULL, &error,&connection);   


      // Allocate an SE_SQL_CONSTRUCT 

      rc = SE_sql_construct_alloc(1, &sqlc);

      sqlc->num_tables = 1;


      //the code crahses at the below strcpy, debug shows sqlc->tables[0] invalid     

      strcpy(sqlc->tables[0],  "TEST");


      printf("table%s\n", sqlc->tables[0]);


      return 0;



Best regards,