robf2@pyuxf.UUCP (robert fair) (07/28/88)
A question for all you Logitech M2 gurus out there: Is it possible to link objects written/compiled in 'C' with a M2 program [specifically Logitech M2 for MS-DOS] ? For example if someone has a package supplied as a library of 'C' routines can I integrate that into my M2 application ? Please reply by e-mail. Many thanks robf. -- Robert L. Fair Contractor. Bell Communications Research/CHC Disclaimer: These represent my Piscataway, NJ opinions only and not those of {ihnp4,allegra}!bcr!pyuxf!robf2 my employer or client.
vandys@hpisoa1.HP.COM (Andrew Valencia) (08/07/88)
/ hpisoa1:comp.lang.modula2 / robf2@pyuxf.UUCP (robert fair) / 7:00 am Jul 28, 1988 / > Is it possible to link objects written/compiled in 'C' with a M2 > program [specifically Logitech M2 for MS-DOS] ? Yes. Logitech is making noises about providing full support, but for now you can pull it off you assembly language glue. Just start with Logitech's instructions on interfacing to MASM assembly, and build a compatible calling interface to C (i.e., pop the arguments off the stack, as M2 wants the callee to do it & C wants the caller to do it). There were some games with segment numbers, but we eventually got a binary-only C library from Network Systems Corp. to interface to our M2 code. Andy
BOTCHAIR@vm.uoguelph.ca (Alex Bewley) (08/22/88)
> 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 a<b,0 if a=b, 1 if a>b *)
GETREG(AX,Result);
IF (Result # 0) THEN
...
The routine is linked in with all the other modules at link-time.
Alex