LPDIRECTDRAW7 cant pass by reference?

Started by
17 comments, last by romer 19 years, 8 months ago
Hey im making a surface creation function, and Im having issues with the pointer not wanting to pass by reference, any other LP variables like surfaces pass with no issues. Was directx designed this way? This is what I get... error C2664: 'DD_Make_Surface' : cannot convert parameter 3 from 'LPDIRECTDRAW7 *__w64 ' to 'LPDIRECTDRAW7' This is my function call...

figure.frame[figure.counter] = DD_Make_Surface( 68, 100, &lpdd, 0, 0 );


Is there ANY way to make the LPDIRECTDRAW7 pointer global or able to pass into functions by reference? I tried by value, and the program crashes...probably because its being copied and im trying to make a surface on a interface that doesnt exist or is valid. Any help is appreciated
Advertisement
what version of directx SDK are you using? can you include the function declaration and definition please?
9.0 Summer 2003

heres the definition
LPDIRECTDRAWSURFACE7 DD_Make_Surface( int x, int y, LPDIRECTDRAW7 lpdd, int flags, int transparant = 0){	DDSURFACEDESC2 ddsd;	LPDIRECTDRAWSURFACE7 lpdds;	memset( &ddsd, 0, sizeof(ddsd) );	ddsd.dwFlags			= DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;	ddsd.ddsCaps.dwCaps		= DDSCAPS_OFFSCREENPLAIN | flags;	ddsd.dwWidth	= x;	ddsd.dwHeight	= y;	lpdd->CreateSurface( &ddsd, &lpdds, NULL );		DDCOLORKEY color;	color.dwColorSpaceHighValue		= 0;	color.dwColorSpaceLowValue		= 0;	lpdds->SetColorKey( DDCKEY_SRCBLT, &color );	return(lpdds);}
how are u declaring lpdd?
like normally LPDIRECTDRAW7 lpdd. Its already a pointer...it wouldnt make a difference how I declare it right? Im confused that when i use the dereference operator it wont pass it, but on any other LP types it works fine.
hmm give me a few let me brainstorm it a sec.
Hmm what compiler are u using?
When you pass it by value have u checked to see where exactly the crash happens?
You will have to step through the code and see where it crashes. Using & is definately wrong in this case.
It crashes right when i make the call to create the surface lpdd

This topic is closed to new replies.

Advertisement