At 03:56 PM 4/26/97 +0200, you wrote:
According to skye:
var gBuffer"^mode13VideoBuffer;
You mean: gBuffer: ^mode13VideoBuffer;-).
yah,... right <grin>
This I don't understand. You mean that you are using a statically allocated video buffer in the Pascal program and passing a pointer to it to the C program? The following should work:
Program Whatever; Type mode13VideoBuffer = array [ 1 .. 320 * 200 ] of Byte; mode13VideoBufferPtr = ^mode13VideoBuffer; Var gBuffer: mode13VideoBuffer; (* NOT a pointer to it *) Procedure ScreenBlit ( Buffer: mode13VideoBufferPtr ); C; begin ScreenBlit ( @gBuffer ); end.
Yes, I can get that to work but what still fails is when gBuffer is allocated using new(): var gBuffer:^mode13VideoBuffer; (* IS a pointer *) ....... new(gBuffer); ....... ScreenBlit( gBuffer); (* crashes in the movedata() from the std C lib *) ....... dispose(gBuffer); ....... end.
Now I'm not too sure how memory allocation works under pascal. Is this right? I don't have many examples to got from and they all work something like this. would this be the same as this in C:
char* gBuffer; gBuffer = malloc(320*200); free(gBuffer);
What's "false" with `New' and `GetMem'? :-)
now I haven't seen GetMem before. The examples I'm using just use the method i've shown above. Does GetMem work like malloc() where I can specify the amount at runtime? (this would be nice). Also, isn't there a limit to the amount of static variable memory I can use (DS)? I don't want to have to fidle with my compiler options to increase it. If I have a static array that is 64k there is potental for probles way down the road, esp. if I have other large static structres.
Sorry about the basic Pascal questions. It is strange switching from C/C++ to Pascal without documentation. I keep trying to do something one way and find out after much frustration that is done another in Pascal. I have only a few Pascal DOCS I have found online and they all use TP. Are there any using GPC?
Hope this helps,
Peter
Very much, thanks.
-Skye