VC写的接口函数:
//显示窗体
void ShowImage()
{
CShowImageDlg dlg;
dlg.DoModal(); //会执行,但是窗体不会弹出,为什么?
}Delphi调用Vc:
procedure TShowimageClass.InitLib_DLL;
Var
   DLLFile : String;
begin
  try
  Begin
   DLLFile        :=ExtractFilePath(ParamStr(0))+'ShowImage.DLL';
   if not FileExists(DllFile) then
   begin
      Application.MessageBox('动态库ShowImage.DLL丢失','信息提示',MB_ICONWARNING+MB_OK);
      exit;
   end;
   hHandle := LoadLibrary(pchar(DLLFile));
   if hHandle <> 0 then  @FShowImage   := GetProcAddress(hHandle,'ShowImage');
 End
 except
 end;
end;procedure TShowimageClass.ShowImage(Str: String);
Var
  m_Path : String;
begin
   if Str='' then Exit;
   m_Path := GetCurrentDir;
   if Not FileExists(Str) then
   Begin
     MessageBox(Application.Handle,PChar('文件 '+Str+' 不存在!'),'系统提示',MB_OK+MB_ICONWARNING);
     Exit;
   End;
   WriteFileName(m_Path+'\Path',PChar(Str));
   FShowImage;
end;

解决方案 »

  1.   

    好久没用Delphi了,好像记的需要加这样的后缀
    ...@一个数字。这个数字的大小就是动态库的出入参的字节数大小。
    我建议还是参考Delphi上的帮助吧。
    上面有例子。
      

  2.   

    VC写的接口函数格式有错,况且vc'dll分两类,其中mfc扩展dll只能供mfc程序使用,还有一类是规则dllinterface function format:
    extern "C" BOOL PASCAL EXPORT ExportedFunction()
    {
      AFX_MANAGE_STATE(AfxGetStaticModuleState());
      // normal function body here
    }
      

  3.   

    楼上的,EXPORT是个啥?应该有
    #ifdef EXPORT
    #define EXPORT __declspec(dllexport)
    #else
    #define EXPORT __declspec(dllimport)
    #endif
    好歹才能跑起来呀