I am having problems pinning an array to pass to a Native function as a reference.

here is the native code:

Code:
typedef HANDLE HDIB

int LoadArrayFromFilename(HDIB ahdib[], int nMax, const char* pszFile);
Now here is my managed to unmanaged bridge function:

Code:
int Toolkit::Dib::LoadArrayFromFilename(array<IntPtr>^% ahdib, int nMax, String^ pzFileName)
{
	pin_ptr<IntPtr> p = &ahdib[0];
	HDIB * native = (HDIB*)p->ToPointer();
	return ::DIB_LoadArrayFromFilename(native, nMax, (char*)SystemStringToCSTR(pzFileName));
}
once inside the native DIB_LoadArrayFromFilename, the pointer 'native' is null, and the clr throws an AccessViolationException ("Trying to read or write protected memory").

Here is example VB code passing an array to be filled out:

Code:
Dim pages(100) As IntPtr
Toolkit.Dib.LoadArrayFromFilename(pages, 100, szFileName)
So, does anyone know what is wrong with my managed bridge function?