有一个系统比较老,但不想放弃,仍然想配上新的设备,新设备用vc编的dll不知如何在turbo c中调用?

解决方案 »

  1.   

    那么如果用obj哪,因为我们碰到过用bc4.1编译出来的16位的obj,那么tc是不是可以自己写这样的obj?
      

  2.   

    调用是没有希望了,不过可以换换思路,新设备写一个exe应用,作为命令的收发端,老系统也再用tc写一个组件与它偕同工作,相对难度会降低很多。
      

  3.   

    到msdn查查,好像有这方面的资料。
      

  4.   

    short FindArtist(LPCTSTR artist);
    short AddArtist(LPCTSTR artist, LPCTSTR country, short century);
    short FindArtifact(LPCTSTR name, LPCTSTR artist);
    short AddArtifact(LPCTSTR artist, LPCTSTR name, short price);// art.c
    // A simple program that uses LoadLibrary and 
    // GetProcAddress to access FindArtist function from art.dll. 
    #include <stdio.h> 
    #include <windows.h> //Define the function prototype
    typedef short (CALLBACK* FindArtistType)(LPCTSTR);void main(void) 

       BOOL freeResult, runTimeLinkSuccess = FALSE; 
       HINSTANCE dllHandle = NULL;              
       FindArtistType FindArtistPtr = NULL;   //Load the dll and keep the handle to it
       dllHandle = LoadLibrary("art.dll");   // If the handle is valid, try to get the function address. 
       if (NULL != dllHandle) 
       { 
          //Get pointer to our function using GetProcAddress:
          FindArtistPtr = (FindArtistType)GetProcAddress(dllHandle,
             "FindArtist");      // If the function address is valid, call the function. 
          if (runTimeLinkSuccess = (NULL != FindArtistPtr))
          {
             LPCTSTR myArtist = "Duchamp";
             short retVal = FindArtistPtr(myArtist);
          }      //Free the library:
          freeResult = FreeLibrary(dllHandle);       
       }   //If unable to call the DLL function, use an alternative. 
       if(!runTimeLinkSuccess)
          printf("message via alternative method\n"); 
    }
      

  5.   

    不可以
    Win32 的 PE 文件格式和 DOS 下的 16 位 PE 文件格式是不同的
      

  6.   

    除非你用VC写一个win32控制台应用程序,那就可以调用DLL,因为都是32位的。