Memory exception of calling OCCI in DLL

From: Dreamer <shen.liang_at_fedex.com>
Date: 23 Oct 2002 03:54:24 -0700
Message-ID: <faa4b418.0210230254.67be948_at_posting.google.com>


hi, hello every one.
I develop a dll of windows, using OCCI. but I got a memory exception when I try to get the meta data of
table(metaData.getVector(MetaData::ATTR_LIST_COLUMNS)). it is just like you don't specify the _MT,_DLL in VC++ when you compile the oracle example.

The following is my code, it is ok in .exe, but when I use them in .dll, it is wrong
void getTableMeta(const string& strTable, vector<string>& strArray,vector<int>& nTypes)
{
/* Call the getMetaData method on the Connection object obtainedv*/
MetaData metaData = conn->getMetaData(strTable,MetaData::PTYPE_TABLE);

/* Call getInt to get the number of columns in the table */
int columnCount=metaData.getInt(MetaData::ATTR_NUM_COLS); ---->OK

vector<MetaData>listOfColumns;
listOfColumns=metaData.getVector(MetaData::ATTR_LIST_COLUMNS);---->WRONG ...

I debug it, and find the reason for it. because the OCCI manage memory for itself, the getVector() return a tempory object vector<MetaData>, when the tempory object need be released, it call the global function free(), so error happen, just like you don't specify the _MT,_DLL.

So who can tell me how I can do to avoid it???

Please save me. Received on Wed Oct 23 2002 - 12:54:24 CEST

Original text of this message