Many thanks for you answer, but problems
---------------
c++ method
-------------------------------------------
long __declspec(dllexport) __stdcall Register( const char* szServiceName, const char *szSymbolName, VARIANT& pVariantArray)
{
SAFEARRAY FAR ** pSArray = V_ARRAYREF(&pVariantArray);
UINT uDim=0;
if ( (uDim=SafeArrayGetDim(*pSArray)) != 2 )
{
char errbuf[512];
sprintf ( errbuf, "failed (%d): The variant array dimension is not equal to 2", lRet );
}
----------------------------------------------------------
but Iget an error, this is the error I get when pass the pointer to the c++ method
"First-chance exception in DllC++.net.exe (OLEAUT32.DLL): 0xC0000005: Access Violation."
Any ideas please Many thanks in advance.

DLLIMPORT AND VARIANT ARRAY
Fahad1
But I cannot alter this c++ code as its somebody else code and its currently in production..
Refering to your earlier c# sample code
I tried
public
static extern int Register(string strService , string strSymbol, ref IntPtr varArray );instead of
public static extern int Register(string strService , string strSymbol, IntPtr varArray );
i.e., added ref to it ...Now I dont get any error but the array when I debug in the c++ code , I can see lbound value "2042177780" and ubound value "2042112432" definitely I am going wrong somewhere , dont know where... becos the array I pass is only object[4,2]...Any ideas, please help..
fyi
--------------------
c++ code for getting dimensions
--------------------
SafeArrayGetDim(*pSArray) -- works fine
long Row_lbound=0, Row_ubound=0;
SafeArrayGetLBound(*pSArray,1,&Row_lbound); //value not correct
SafeArrayGetUBound(*pSArray,1,&Row_ubound); //value not correct
long lNbrRows = Row_ubound - Row_lbound + 1; //value not correct
long Col_lbound=0, Col_ubound=0;
SafeArrayGetLBound(*pSArray,2,&Col_lbound); //value not correct
SafeArrayGetUBound(*pSArray,2,&Col_ubound);//value not correct
long lNbrCols = Col_ubound - Col_lbound + 1;//value not correct
--------------------
Thanks a lot ..
shaunhey
SAFEARRAY * pArrayVal = pVariantArray.parray;
VARIANT *pArray = NULL;
HRESULT hr = S_OK;
hr = SafeArrayAccessData(pArrayVal, (
void HUGEP * FAR *) &pArray);/* use pArrayVal here */
SafeArrayUnaccessData( pArrayVal );
David Friedland