S
Scott McFadden
What is the proper way to pass pointers by reference from managed c++ calls
to native c++ calls?
In managed C++, I have a pointer to an array of structures, that I pass to a
native c++ method by reference:
//Managed c++
QueryResult* qr = NULL;
ExecuteQuery(1, "abc", qr); //invoke native c++ method passing qr by
reference
//Native c++
void ExecuteQuery(int queryId, string queryParams, QueryResult*& results)
{
results = (QueryResult*)calloc(1000, sizeof(QueryResults));
//execute query against file system and populate results
}
My problem is that QueryResults is valid / populated in the context of
Native code dll (ExecuteQuery) but upon the return of that call into Managed
C++, the qr / QueryResults param is NULL. Anyone else have this prob?
thanks
sm
to native c++ calls?
In managed C++, I have a pointer to an array of structures, that I pass to a
native c++ method by reference:
//Managed c++
QueryResult* qr = NULL;
ExecuteQuery(1, "abc", qr); //invoke native c++ method passing qr by
reference
//Native c++
void ExecuteQuery(int queryId, string queryParams, QueryResult*& results)
{
results = (QueryResult*)calloc(1000, sizeof(QueryResults));
//execute query against file system and populate results
}
My problem is that QueryResults is valid / populated in the context of
Native code dll (ExecuteQuery) but upon the return of that call into Managed
C++, the qr / QueryResults param is NULL. Anyone else have this prob?
thanks
sm