home *** CD-ROM | disk | FTP | other *** search
/ Fun Online 1996 September / FOL0996.iso / DOUBLE_T / PLAYABLE / DLL.H < prev    next >
Text File  |  1995-01-18  |  3KB  |  117 lines

  1. //
  2. // 386FX file & DLL loader functions/equates
  3. //
  4.  
  5. #ifndef DLL_H
  6. #define DLL_H
  7.  
  8. #include <string.h>  // (for size_t definition)
  9.  
  10. //
  11. // MetaWare support
  12. //
  13.  
  14. #ifdef __HIGHC__
  15. #define cdecl _CC(_REVERSE_PARMS | _NEAR_CALL)
  16. #pragma Global_aliasing_convention("_%r");
  17. #endif
  18.  
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22.  
  23. #ifndef FILE_ERRS
  24. #define FILE_ERRS
  25.  
  26. #define NO_ERROR        0
  27. #define IO_ERROR        1
  28. #define OUT_OF_MEMORY   2
  29. #define FILE_NOT_FOUND  3
  30. #define CANT_WRITE_FILE 4
  31. #define CANT_READ_FILE  5
  32. #define DISK_FULL       6
  33.  
  34. #endif
  35.  
  36. #ifndef TYPEDEFS
  37. #define TYPEDEFS
  38.  
  39. typedef unsigned char  UBYTE;
  40. typedef unsigned short UWORD;
  41. typedef unsigned long  ULONG;
  42. typedef char  BYTE;
  43. typedef short WORD;
  44. typedef long  LONG;
  45.  
  46. #endif
  47.  
  48. //
  49. // malloc() / free() wrapper functions
  50. // 
  51.  
  52. extern void * (*MEM_alloc) (size_t);
  53. extern void   (*MEM_free)  (void *);
  54.  
  55. void * cdecl MEM_use_malloc(void *(*fn)(size_t));
  56. void * cdecl MEM_use_free  (void (*fn)(void *));
  57.  
  58. //
  59. // Other memory-management functions
  60. //
  61.  
  62. LONG   cdecl MEM_alloc_DOS    (ULONG  n_paras, 
  63.                                void **protected_ptr, 
  64.                                ULONG *segment_far_ptr,
  65.                                ULONG *selector);
  66.  
  67. void   cdecl MEM_free_DOS     (void  *protected_ptr, 
  68.                                ULONG  segment_far_ptr,
  69.                                ULONG  selector);
  70.  
  71. void * cdecl MEM_alloc_lock   (size_t size);
  72.  
  73. void   cdecl MEM_free_lock    (void  *ptr, 
  74.                                size_t size);
  75.  
  76. LONG   cdecl VMM_lock_range   (void *p1, void *p2);
  77. LONG   cdecl VMM_unlock_range (void *p1, void *p2);
  78.  
  79. LONG   cdecl VMM_lock         (void *start, ULONG size);
  80. LONG   cdecl VMM_unlock       (void *start, ULONG size);
  81.  
  82. //
  83. // DLL loader flags & functions
  84. //
  85.  
  86. #define DLLSRC_FILE  0     // *source is filename string
  87. #define DLLSRC_MEM   1     // *source is pointer to DLL image in memory
  88. #define DLLMEM_USER  2     // *dll -> output memory block alloc'd by user
  89. #define DLLMEM_ALLOC 4     // *dll = don't care; allocate & return output mem
  90.  
  91. ULONG  cdecl DLL_size   (void *source, ULONG flags);
  92. void * cdecl DLL_load   (void *source, ULONG flags, void *dll);
  93.  
  94. //
  95. // File functions
  96. //
  97.  
  98. LONG   cdecl FILE_error (void);
  99. LONG   cdecl FILE_size  (BYTE *filename);
  100. void * cdecl FILE_read  (BYTE *filename, void *dest);
  101. LONG   cdecl FILE_write (BYTE *filename, void *buf, ULONG len);
  102. LONG   cdecl FILE_append(BYTE *filename, void *buf, ULONG len);
  103.  
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107.  
  108. //
  109. // MetaWare support
  110. //
  111.  
  112. #ifdef __HIGHC__
  113. #pragma Global_aliasing_convention();
  114. #endif
  115.  
  116. #endif
  117.