Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!vm.uoguelph.ca!BOTCHAIR
From: BOTCHAIR@vm.uoguelph.ca (Alex Bewley)
Newsgroups: comp.lang.modula2
Subject: Re: Interlanguage access
Message-ID: 
Date: 21 Aug 88 17:20:49 GMT
References: 
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: Info-Modula2 Distribution List 
Organization: The Internet
Lines: 20


> This is about accessing C routines from Logitech Modula-2

    You need version 3.0.  There is a SYSTEM routine called EXTCALL, and you
can use that to access other language routines.  But all parameter passing must
be done using CODE statements before the call.  For example:

    (* call a 'C' routine *)
    SETREG(AX,10);
    CODE(PushAX);
    SETREG(BX,20);
    CODE(PushBX);
    EXTCALL("_larger"); (* let's say returns -1 if ab *)
    GETREG(AX,Result);
    IF (Result # 0) THEN
      ...

    The routine is linked in with all the other modules at link-time.

        Alex