#pragma warn(wall=>on) #include #include #include /* routine to be called from Modula using Modula conventions (see multi1.def) */ #pragma save, name(prefix=>"multi1$"), call(c_conv=>off) void x(long a,long b,long c,long d){ printf("multi1.x called: a=%ld,b=%ld,c=%ld,d=%ld\n",a,b,c,d); p(a,b,c,d); } #pragma restore /* routine to be called from Modula using C conventions (see multi1.def) */ void y(long a,long b,long c,long d){ printf("multi1.y called: a=%ld,b=%ld,c=%ld,d=%ld\n",a,b,c,d); q(a,b,c,d); } /* initialisation routine, which will be called before main module is executed */ static void init(){ printf("multi1.init called\n"); IO$WrStr(25,"IO.WrStr called from 'C'"); IO$WrLn(); } /* example of how to do modula style initialisation in 'C' */ #pragma save, name(prefix=>"") /* have to use Modula naming convention */ #define NSUB 2 /* number of sub-modules called from this module */ #ifdef _fdata #define INITDATA far #else #define INITDATA near #endif extern char INITDATA multi2$[], INITDATA IO$[]; /* list of sub-modules called from this module */ struct { void (*initfunc)(void); char INITDATA *sub[NSUB]; int term; } multi1$ = { init, /* initialisation routine */ multi2$, IO$, /* list of sub-modules called from this module */ -1 /* terminator */ }; #pragma restore /* link in multi2.obj (alternatively insert the line 'include multi2' in project file multi.prj)*/ #pragma link(multi2)