Article # 591, added by Geoworks, historical record
| first | previous | index | next | last |

Missing C-stub: GrSetVMFile



C routine:  GrSetVMFile
Date Fixed: 1/95

It turns out that there is a missing C stub for the GrSetVMFile
routine before January 1995. You can still use the routine, but
it will require writing a C stub and compiling that stub into your
application. This is not too difficult, so I have included a small
.asm source file that you should put in your application directory.
This will compile with the rest of your application (so you will
have to clean the directory and redo mkmf and pmake depend).

The C stub itself is written in assembly like this (I called the
file grsetvm.asm): 

;---------------------begin grsetvm.asm-----------------------
include geos.def
include graphics.def			; contains GrSetVMFile routine

global GRSETVMFILE:far			; allow C-stub to be used externally

CommonCode	segment resource	; a code resource block

GRSETVMFILE	proc far gsHandle:word,
			 vmHandle:word
	.enter

	; save di because Goc doesn't like it being trashed
	push	di

	; put all parameters into the necessary registers
	mov	di, gsHandle
	mov	ax, vmHandle

	; call the assembly version of this routine
	call	GrSetVMFile

	; no return parameters to worry about

	; remember to restore di
	pop	di

	.leave
	ret
GRSETVMFILE	endp

CommonCode	ends			; end of code resource block
;----------------------end grsetvm.asm------------------------


Since GrSetVMFile is already prototyped in graphics.h, you don't need
to worry about prototyping the routine.

The capitalized routine name (i.e., GRSETVMFILE) in the .asm file
corresponds to the mixed-case routine name (i.e., GrSetVMFile) in 
the .goc or .goh file. (The _pascal directive in the prototype causes
the C compiler to upper-case the entire routine name, which is why the
C stub routine name is all upper-case.)

The call to the mixed-case routine name in the .asm file is the
routine name in the graphics library.