Custom DLL Test.c 623 B

123456789101112131415161718192021222324
  1. #define USE_TI89
  2. #include <tigcclib.h>
  3. #define HelloFromDLL _DLL_call(void,(void),0)
  4. #define SumFromDLL _DLL_call_attr(int,(int,int),__attribute__((stkparm)),1)
  5. #define MessageInDLL _DLL_reference(const char,2)
  6. #define GlobalVarInDLL _DLL_glbvar(long,3)
  7. void _main(void)
  8. {
  9. if (LoadDLL ("mydll", 372377271, 2, 11) != DLL_OK)
  10. {
  11. DlgMessage ("ERROR", "Error loading DLL!", BT_OK, BT_NONE);
  12. return;
  13. }
  14. clrscr ();
  15. GlobalVarInDLL = 1234567;
  16. HelloFromDLL ();
  17. printf ("Sum from DLL: 2+3=%d\n", SumFromDLL (2, 3));
  18. printf ("Message from DLL: %s\n", MessageInDLL);
  19. ngetchx ();
  20. UnloadDLL ();
  21. }