In our previous episode, Guillermo Mart?nez Jim?nez said:
>   fSize := aObject^.size;
>   GetMem (fData, fSize);
>   Move (aObject^.dat, fData, fSize);
> 
> Both "fData" and "dat" are untyped POINTER but the program returns an
> "Segment violation" at the Move procedure. I've checked the pointers
> and both are valid (I mean not NIL) and size is always more than zero.

Both are .dat and fdata are points. IOW you are moving "fsize" bytes from
the place where the 4 byte of the pointer dat is stored to the place where
the 4 bytes of the pointer fdata is stored. Since you probably move more
than 4 bytes you totally corrupt what is behind "fdata" in memory.

Try  .dat^ and fdata^ in the move line.
 
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to