本人从来没有用过Delphi,但是最近需要用VC给某人写个DLL或ActiveX,他用Delphi.不知在我写的DLL中需要注意些什么呢?

解决方案 »

  1.   

    DLL:
    function MyFunction(S: string): string; external 'MYDLL.dll';
    ActiveX:
    菜单 Component\Import ActiveX Control...
    然后与使用VCL差不多!
      

  2.   

    调用dll有三种方法,楼上的只说了一种,其他的相对比较麻烦
    1:function MyFunction(s:string;i:integer;...):boolean stdcall; external 'DLLName.dll' index x;2:function MyFunction(s:string;i:integer;...):Integer stdcall; external 'DLLName.dll' name 'FunctionName';
      

  3.   

    静态:function MyFunction(..): type stdcall; external 'DLLName.dll';
    动态:
    type
      TOleRegisterFunction = function : HResult;
    ...
    hLibraryHandle := LoadLibrary(PCHAR(strOleFileName));
      if (hLibraryHandle > 0) then      try
                    if (OleAction = RegisterOle) then           hFunctionAddress := GetProcAddress(hLibraryHandle, pchar('DllRegisterServer'))
               else               hFunctionAddress := GetProcAddress(hLibraryHandle, pchar('DllUnregisterServer'));
            if (hFunctionAddress <> NIL) then           begin
                 RegFunction := TOleRegisterFunction(hFunctionAddress);             if RegFunction >= 0 then                 result := true;
               end;
          finally
            FreeLibrary(hLibraryHandle);
          end;