@Uhrwerk, Just Sid:
I see what you are saying about C_LINK link; getting copied by mem copy, so that you effectivly have 2 bmaps with the same handle, and i also see your argument that memcpy() will copy only the pointers for *pixels, *d3dtex, & *finalbits without copying the data that they point to.

Given that memcpy() will copy the pointers and not the data, if i write to one bmap, it would write to both, because each bmap is pointing to the same data. But i have run the code, and was able to write to one without affecting the other.

Here is the code:

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////

ENTITY* e1;

BMAP* bmp_original = "bmap_to_copy.bmp";
BMAP* bmp_clone;

PANEL* pnl_original = {
	pos_x = 0;
	flags = SHOW;
}

PANEL* pnl_clone = {
	pos_x = 64;
	flags = SHOW;
}


void bmap_cross(){
	
	BMAP* tgablitz = pnl_original.bmap;
	var format; 
	var pixel;
	format = bmap_lock(tgablitz,0);
	if (format >= 565) {
		pixel = pixel_for_vec(vector(0,0,255),100,format); // red color
		pixel_to_bmap(tgablitz,10,10,pixel);
		pixel_to_bmap(tgablitz,10,11,pixel);
		pixel_to_bmap(tgablitz,10,12,pixel);
		pixel_to_bmap(tgablitz,10,13,pixel);
		pixel_to_bmap(tgablitz,10,14,pixel);
		pixel_to_bmap(tgablitz,8,12,pixel);
		pixel_to_bmap(tgablitz,9,12,pixel);
		pixel_to_bmap(tgablitz,11,12,pixel);
		pixel_to_bmap(tgablitz,12,12,pixel);
	}
	bmap_unlock(tgablitz);
}

BMAP *bmap_clone(BMAP* bmp){
	
	BMAP* bmpNew = malloc(sizeof(BMAP));
	memcpy(bmpNew, bmp, sizeof(BMAP));
	return(bmpNew);
}

void main(){
	
	wait(1);
	
	bmp_clone = bmap_clone(bmp_original);
	
	pnl_original.bmap = bmp_original;
	pnl_clone.bmap = bmp_clone;
	
	bmap_cross();
}



(this is just a re-paste of Mr. Guests earlier code.)

When I run the above code, I end up with 2 bitmaps on the screen, one with a red_cross on it and one without the red cross.

So now i am just confused. I think JustSid and Uhrwerk are both correct in their statements - memcpy() will copy the pointers without copying the data they point to, so when i modify the data - it would modify both bmaps because they are the same bmap. But if that is so, than how am i getting 2 distinct bmaps?