最近作一个项目, 需要用到DLL,我以前从未接写过DLL(只是听说过,了解一些基础知识),给为能不能介绍一些这方面的具体实例(小一点的就可以),或者给一些这方面的电子文档(最好有大量的实例)?我看了一点这方面的介绍,感觉就是没有一些基础的实例源码.谢谢!!

解决方案 »

  1.   

    新建工程里面不就有一个dll wizard项目吗。在项目文件中exports关键字下写下导出函数(包含)的名字。然后编译,build就可以生成dll文件了.
      

  2.   

    File--New--Others--DLL Wizard
    给你一段最简单的daima
    library Project2;{ Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }uses
      SysUtils,
      Classes;{$R *.res}function mytest(num1:integer):integer; stdcall;begin
    result:=num1;
    end;exports
      add;begin
    end.