dll.h 1.3 KB

123456789101112131415161718192021222324252627282930
  1. #ifndef __DLL
  2. #define __DLL
  3. #ifndef KERNEL_NEW
  4. #include <default.h>
  5. #endif
  6. #define __DLL_SIGNATURE 0x444C4C20
  7. typedef struct{unsigned long Signature,ID;unsigned short major,minor;void*jump_table[];}__DLL_interface_struct;
  8. extern __DLL_interface_struct*__DLL_interface_ptr;
  9. extern void*__DLL_body_ptr;
  10. /* Begin Auto-Generated Part */
  11. enum DLL_ErrorCodes{DLL_OK,DLL_NOTINGHOSTSPACE,DLL_NOTFOUND,DLL_LOCKFAILED,DLL_OUTOFMEM,DLL_ALREADYLOADED,DLL_WRONGVERSION};
  12. #define _DLL_call_attr(type,args,attr,index) (*(type(*attr)args)_DLL_entry(index))
  13. #define _DLL_call(type,args,index) (*(type(*)args)_DLL_entry(index))
  14. #define _DLL_entry(index) (__DLL_interface_ptr->jump_table[index])
  15. #define _DLL_glbvar(type,index) (*(_DLL_reference(type,index)))
  16. #define _DLL_reference(type,index) ((type*const)_DLL_entry(index))
  17. extern short LoadDLL(const char*,long,short,short)__ATTR_LIB_C__;
  18. extern void LoadDLLThrow(const char*,long,short,short)__ATTR_LIB_C__;
  19. extern void UnloadDLL(void)__ATTR_LIB_C__;
  20. #define DLL_EXPORTS ,{
  21. #define DLL_ID __DLL_interface_struct __DLL_interface __attribute__((__section__("_stl20")))={__DLL_SIGNATURE,
  22. #define DLL_IMPLEMENTATION ,(void*)-1L}};
  23. #define DLL_INTERFACE asm(".xdef _nostub_dll\n\t.xdef __ld_ignore_global_imports");
  24. #define DLL_VERSION ,
  25. /* End Auto-Generated Part */
  26. #endif