home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vp21beta.zip / AEXMPSRC.RAR / DLL / TESTDLL2.PAS < prev    next >
Pascal/Delphi Source File  |  2000-08-15  |  1KB  |  43 lines

  1. {█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
  2. {█                                                       █}
  3. {█      Virtual Pascal Examples. Version 2.1.            █}
  4. {█      Using an import library                          █}
  5. {█      ─────────────────────────────────────────────────█}
  6. {█      Copyright (C) 1996-2000 vpascal.com              █}
  7. {█                                                       █}
  8. {▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
  9.  
  10. program TestDll2;
  11.  
  12. // This example demonstrates how to use an Import Library to easily
  13. // import functions from a DLL.  First, tell the compiler that we want
  14. // "original" names with no unit names prepended:
  15.  
  16. {$OrgName+}
  17.  
  18. // Second, list the functions - by the names they were exported from the
  19. // DLL - with external; directives:
  20.  
  21. procedure TestProc1; external;
  22. procedure Test2; external;
  23. procedure TestProc3; external;
  24. function TestFunc(a, b: Longint): Longint; cdecl; external;
  25.  
  26. // Last, tell the linker which import library it can use to look up the
  27. // external entry points:
  28.  
  29. {$L TSTVPDLL.LIB}
  30.  
  31. // The import library was generated either by specifying "Use DLL" on the
  32. // Options->Linker page of the IDE, or by using IMPLIB:
  33. //  IMPLIB TSTVPDLL.LIB TSTVPDLL.DLL
  34.  
  35. // Now call the functions of the DLL:
  36.  
  37. begin
  38.   TestProc1;
  39.   Test2;
  40.   TestProc3;
  41.   writeln('3 + 4 is ',TestFunc(3,4));
  42. end.
  43.