home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / DICEC-1.DMS / in.adf / README.PRAGMAS.DOC < prev   
Encoding:
Text File  |  1993-07-21  |  2.7 KB  |  93 lines

  1.  
  2.            FDTOPRAGMA / 3.0 INCLUDES GENERATED PRAGMAS
  3.  
  4.     If you compile under the -3.0 model using the 3.0 includes, generally
  5.     something only feasible if you have a hard drive, you can use pragmas
  6.     to access system libraries.  You can use FDTOPRAGMA to create pragmas
  7.     for third party libraries as described in the FDTOPRAGMA section below.
  8.  
  9.     In your C source you should use #include <proto/exec.h> instead of
  10.     #include <clib/exec.h>.  Then use the -mi option to DCC.  Be sure
  11.     your DCCOPTS are setup to use the 3.0 includes:
  12.  
  13.     /*
  14.      *    TEST.C
  15.      */
  16.  
  17.     #include <proto/exec.h>
  18.     #include <stdio.h>
  19.  
  20.     main(int ac, char **av)
  21.     {
  22.     printf("%08lx\n", FindTask(NULL));
  23.     return(0);
  24.     }
  25.  
  26.  
  27.     Then, generate some assembly (just so you can see what it does):
  28.  
  29.     dcc test.c -o t:test.a -a -mi -mRR
  30.  
  31.              USING PRAGMAS TO ACCESS LOCAL LIBRARY BASES
  32.  
  33.     The library base specified in any given #pragma is always accessed from
  34.     the current semantic context. That means you can override it:
  35.  
  36.     fubar()
  37.     {
  38.     long SysBase = ...
  39.  
  40.     FindTask(...);    etc...
  41.     }
  42.  
  43.     Many libraries require a library base to be openned for each task, so
  44.     when you use CreateTask() or CreateNewProc() to create several
  45.     instances sharing the same global data you may have to access certain
  46.     libraries with a base variable openned for the particular task/process
  47.     the call is made from.  While DICE does not do this for you
  48.     automatically, you can write code to do it and then access the special
  49.     library base via a local context'd pragma base variable:
  50.  
  51.     Also note that you may have to use __geta4 for the start procedure for
  52.     each new task to reload A4 with the appropriate shared data base. This
  53.     precludes being able to compile something resident (-r doesn't work
  54.     when you use __geta4).
  55.  
  56.     fubar()
  57.     {
  58.     long GlugBase = SpecificLibBaseForThisProcess;
  59.  
  60.     GlugLibraryCallUsingPragma() ...
  61.     }
  62.  
  63.     NOTE!!!! The current registered release of DICE cannot deal with SAS/C
  64.     pragmas.  There are a couple of bugs, so you should only use files
  65.     generated with FDTOPRAGMA with DICE.
  66.  
  67.  
  68.                 USING FDTOPRAGMA
  69.  
  70.  
  71.     NOTE: you must be setup to compile using the 3.0 includes via DCCOPTS.
  72.     Here are two ways of setting up DCCOPTS:
  73.  
  74.     set DCCOPTS "-// -3.0"
  75.     setenv DCCOPTS "-// -3.0"
  76.  
  77.  
  78.     EXAMPLE USAGE - generate a single pragma file:
  79.  
  80.     set DCCOPTS "-3.0 -//"
  81.     cd dinclude:
  82.     fdtopragma amiga30/fd/exec_lib.fd amiga30/clib/exec_protos.h -o t:x.h
  83.  
  84.     EXAMPLE USAGE - generate pragma files for all FD's in a directory
  85.     (NOTE: hanging slashes (/) at end are REQUIRED)
  86.  
  87.     set DCCOPTS "-3.0 -//"
  88.     cd dinclude:
  89.     mkdir t:test
  90.     fdtopragma amiga30/fd/ amiga30/clib/ -o t:test/
  91.  
  92.  
  93.