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

Calling an assembly routine from GOC.



Q. I'm writing a Goc application with a single routine in assembly.
   I prototype the routine (MyDraw) as follows in myapp.goc:

     extern void _far _pascal MyDraw( GStateHandle gstate );

   mydraw.asm contains the Esp source for MyDraw.

   Both files compile successfully, but Glue fails, giving the error:

     file "myapp.goc", line 261: error: MyDraw undefined
     *** Error code 1

   How can I get Glue to link in the routine in the Esp resource?

A. Since you declared MyDraw, in myapp.goc, as using the Pascal
   calling convention, you need do the following in mydraw.asm:

     1) Up-case the name of the MyDraw routine to HELLOMDRAW.
     2) Bracket the routine with SetGeosConvention before and
        SetDefaultConvention after to let Esp know that parameters
        will be passed onto the stack in the same order as Pascal.

   Here is an example:

     SetGeosConvention
     global MYDRAW:far
     MYDRAW     proc    far                          arg1:word arg2:MyStruct ...other args, if any...
             ... body of function ...
     MYDRAW     endp
     SetDefaultConvention