home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / docs / FROM_C.DOC < prev    next >
Encoding:
Text File  |  1994-09-30  |  812 b   |  37 lines

  1. /*
  2. Exported Modula-2 variables and procedures(ie declared in some defintion module)
  3. follow the simple link name convention:
  4.  
  5. _ModuleName_VaribleName
  6. _ModuleName_ProcedureName
  7.  
  8. Example
  9. =======
  10. Calling InOut.WriteInt from 'C':
  11.  
  12. */
  13.  
  14. /*------------ callM2.c -------------------*/
  15.  
  16. extern InOut_BEGIN(void);
  17. extern InOut_WriteInt(int,int);
  18.  
  19. main()
  20. {
  21.   InOut_BEGIN();/* Must call the initialization body of InOut before using it */
  22.           /* Calling InOut_BEGIN more than once wont do any harm */
  23.   InOut_WriteInt(42,2);
  24. }
  25.  
  26. /*------------------------------------*/
  27.  
  28. /*
  29. Compile with
  30. >dcc -Lmodula:obj callM2.c InOut.o StdIO.o modula:lib/m2.lib
  31.  
  32. InOut.mod imports StdIO.mod (* StdIO macros not implemented in c.lib *)
  33.  
  34. For an example of calling a 'C' function from within a Modula module see
  35. directory examples/for_c/ .
  36. */
  37.