⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mydll.cpp

📁 有视频
💻 CPP
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
//   Important note about DLL memory management when your DLL uses the
//   static version of the RunTime Library:
//
//   If your DLL exports any functions that pass String objects (or structs/
//   classes containing nested Strings) as parameter or function results,
//   you will need to add the library MEMMGR.LIB to both the DLL project and
//   any other projects that use the DLL.  You will also need to use MEMMGR.LIB
//   if any other projects which use the DLL will be perfomring new or delete
//   operations on any non-TObject-derived classes which are exported from the
//   DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
//   EXE's to use the BORLNDMM.DLL as their memory manager.  In these cases,
//   the file BORLNDMM.DLL should be deployed along with your DLL.
//
//   To avoid using BORLNDMM.DLL, pass string information using "char *" or
//   ShortString parameters.
//
//   If your DLL uses the dynamic version of the RTL, you do not need to
//   explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------
//USEDEF("mydll.def");
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) __stdcall int mycalc(int,int);
extern "C" __declspec(dllexport) __stdcall void myte(void);
extern "C" __declspec(dllexport) __stdcall int myfunc(int,int);
int add(int n1,int n2);
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
        return 1;
}
//---------------------------------------------------------------------------
__declspec(dllexport) __stdcall void myte(void)
{
  ShowMessage("OK this is DLL");
}
//---------------------------------------------------------------------------
__declspec(dllexport) __stdcall int myfunc(int n1,int n2)
{
  int aa;
  aa=add(n1,n2);
  return aa;
}
//---------------------------------------------------------------------------
__declspec(dllexport) __stdcall int mycalc(int n1,int n2)
{
  return n1*n2;
}
//---------------------------------------------------------------------------
int add(int n1,int n2)
{
  return n1+n2;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -