Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DLL found with VS2003 but not VS2005

DLL found with VS2003 but not VS2005

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++visual-studiosysadminwindows-admin
8 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Merlin Tintin
    wrote on last edited by
    #1

    Hello, I have a great problem that move the brain of all my team. We have developped a DLL with VS2003 in C++ and a test program to test this DLL (a) - Win32 Console application. The DLL (a) uses other DLL (b). It is working fine (on XP, and Windows Server 2003) Now I have a new version of DLL (b), so I have migrate my DLL (a) with VS2005. I've tested it and it's working fine on some PC but not on some ohter. Work on some XP machine, but never Windows Server 2003. PC where it is working fine have VS2003, VS2005 but my PC have both VS and it does not work. One more thing, I cannot compile the new solution VS2005 of the DLL (a). Here is some code of my test program: typedef LPCSTR DLLDIR (__stdcall *DllPlay) (LPCSTR name, LPCSTR file, ...); int _tmain(int argc, _TCHAR* argv[]) { DllPlay playDll; HINSTANCE hDLL; hDLL = LoadLibrary("ReplayBox.dll"); if (hDLL!=NULL) { playDll = (DllPlay) GetProcAddress(hstreamDLL, "?Play@@YGPB0K0H_NHH@Z"); if (playDll!=NULL) { printf("Play found\n"); result = (playDll)("myLogin","machin.wav", ...); printf("result : %s",result); } else { printf("Play not found\n"); } } else { printf("DLL not found !!!\n"); <- ERROR : GO HERE WITH VS2005 DLL !! } } When it's failed, it is due to the fact that my DLL (a) is not found. It could come also from one of the depenedency of DLL (a) with DLL (b). All DLL and test application are in the same directory. I do not undestand why it's not working on some machine. Help ? Advice ?

    La Richesse & la Gloire ne griseront jamais que les temples

    I R 2 Replies Last reply
    0
    • M Merlin Tintin

      Hello, I have a great problem that move the brain of all my team. We have developped a DLL with VS2003 in C++ and a test program to test this DLL (a) - Win32 Console application. The DLL (a) uses other DLL (b). It is working fine (on XP, and Windows Server 2003) Now I have a new version of DLL (b), so I have migrate my DLL (a) with VS2005. I've tested it and it's working fine on some PC but not on some ohter. Work on some XP machine, but never Windows Server 2003. PC where it is working fine have VS2003, VS2005 but my PC have both VS and it does not work. One more thing, I cannot compile the new solution VS2005 of the DLL (a). Here is some code of my test program: typedef LPCSTR DLLDIR (__stdcall *DllPlay) (LPCSTR name, LPCSTR file, ...); int _tmain(int argc, _TCHAR* argv[]) { DllPlay playDll; HINSTANCE hDLL; hDLL = LoadLibrary("ReplayBox.dll"); if (hDLL!=NULL) { playDll = (DllPlay) GetProcAddress(hstreamDLL, "?Play@@YGPB0K0H_NHH@Z"); if (playDll!=NULL) { printf("Play found\n"); result = (playDll)("myLogin","machin.wav", ...); printf("result : %s",result); } else { printf("Play not found\n"); } } else { printf("DLL not found !!!\n"); <- ERROR : GO HERE WITH VS2005 DLL !! } } When it's failed, it is due to the fact that my DLL (a) is not found. It could come also from one of the depenedency of DLL (a) with DLL (b). All DLL and test application are in the same directory. I do not undestand why it's not working on some machine. Help ? Advice ?

      La Richesse & la Gloire ne griseront jamais que les temples

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      Merlin Tintin wrote:

      "?Play@@YGPB0K0H_NHH@Z"

      Going from the above quote, you are using C++, and exporting a C++ function. You've noticed the name mangling, (sorry, "decorating"), and have tried to compensate for it. This decoration is famously fragile, and you can't mix C++ exported functions with different compilers. I bet 2003 and 2005 have different decoration. If I'm right, the fix is simple. Here is a snippet of a function I export from one of my Extendy DLLs.

      extern "C" {
      BOOL __declspec(dllexport) GetBusModuleDetailsW (BusModuleInformation *info, UINT nFlags);
      }
      BOOL __declspec(dllexport) GetBusModuleDetailsW (BusModuleInformation *info, UINT nFlags)
      {
      ....
      }

      And here is how I load it:

      typedef BOOL (*BUSGETMODULEINFORMATION)(BusModuleInformation *info, UINT nFlags);

      ....

      g\_hModuleBus = ::LoadLibrary (sModule);
      BUSGETMODULEINFORMATION md = NULL;
      
      if (g\_hModuleBus)
      {
      	md = (BUSGETMODULEINFORMATION) ::GetProcAddress (g\_hModuleBus, "GetBusModuleDetailsW");
      	if (!md)
      	{
      		FreeLibrary (g\_hModuleBus);
      		g\_hModuleBus = NULL;
      	}
      }
      else
      	md = GetBusModuleDetailsW;
      
      if (md)
      {
      	(md) (&somestruct, SOME\_FLAGS);
      

      Some code has been changed, as it's not relevant to you what structures and flags do what within my software. So, you could make your DLLs safe using extern "c" in vs2003, then compile the appropriate ones in vs2005. Good luck, Iain.

      Iain Clarke appearing in spite of being begged not to by CPallini.

      R 1 Reply Last reply
      0
      • I Iain Clarke Warrior Programmer

        Merlin Tintin wrote:

        "?Play@@YGPB0K0H_NHH@Z"

        Going from the above quote, you are using C++, and exporting a C++ function. You've noticed the name mangling, (sorry, "decorating"), and have tried to compensate for it. This decoration is famously fragile, and you can't mix C++ exported functions with different compilers. I bet 2003 and 2005 have different decoration. If I'm right, the fix is simple. Here is a snippet of a function I export from one of my Extendy DLLs.

        extern "C" {
        BOOL __declspec(dllexport) GetBusModuleDetailsW (BusModuleInformation *info, UINT nFlags);
        }
        BOOL __declspec(dllexport) GetBusModuleDetailsW (BusModuleInformation *info, UINT nFlags)
        {
        ....
        }

        And here is how I load it:

        typedef BOOL (*BUSGETMODULEINFORMATION)(BusModuleInformation *info, UINT nFlags);

        ....

        g\_hModuleBus = ::LoadLibrary (sModule);
        BUSGETMODULEINFORMATION md = NULL;
        
        if (g\_hModuleBus)
        {
        	md = (BUSGETMODULEINFORMATION) ::GetProcAddress (g\_hModuleBus, "GetBusModuleDetailsW");
        	if (!md)
        	{
        		FreeLibrary (g\_hModuleBus);
        		g\_hModuleBus = NULL;
        	}
        }
        else
        	md = GetBusModuleDetailsW;
        
        if (md)
        {
        	(md) (&somestruct, SOME\_FLAGS);
        

        Some code has been changed, as it's not relevant to you what structures and flags do what within my software. So, you could make your DLLs safe using extern "c" in vs2003, then compile the appropriate ones in vs2005. Good luck, Iain.

        Iain Clarke appearing in spite of being begged not to by CPallini.

        R Offline
        R Offline
        Rajkumar R
        wrote on last edited by
        #3

        hDLL = LoadLibrary("ReplayBox.dll");
        if (hDLL!=NULL)
        {
        ....
        }
        else
        {
        printf("DLL not found !!!\n"); <- ERROR : GO HERE WITH VS2005 DLL !!
        }

        May be i understood wrongly, he was saying failed at loading library.

        I 1 Reply Last reply
        0
        • M Merlin Tintin

          Hello, I have a great problem that move the brain of all my team. We have developped a DLL with VS2003 in C++ and a test program to test this DLL (a) - Win32 Console application. The DLL (a) uses other DLL (b). It is working fine (on XP, and Windows Server 2003) Now I have a new version of DLL (b), so I have migrate my DLL (a) with VS2005. I've tested it and it's working fine on some PC but not on some ohter. Work on some XP machine, but never Windows Server 2003. PC where it is working fine have VS2003, VS2005 but my PC have both VS and it does not work. One more thing, I cannot compile the new solution VS2005 of the DLL (a). Here is some code of my test program: typedef LPCSTR DLLDIR (__stdcall *DllPlay) (LPCSTR name, LPCSTR file, ...); int _tmain(int argc, _TCHAR* argv[]) { DllPlay playDll; HINSTANCE hDLL; hDLL = LoadLibrary("ReplayBox.dll"); if (hDLL!=NULL) { playDll = (DllPlay) GetProcAddress(hstreamDLL, "?Play@@YGPB0K0H_NHH@Z"); if (playDll!=NULL) { printf("Play found\n"); result = (playDll)("myLogin","machin.wav", ...); printf("result : %s",result); } else { printf("Play not found\n"); } } else { printf("DLL not found !!!\n"); <- ERROR : GO HERE WITH VS2005 DLL !! } } When it's failed, it is due to the fact that my DLL (a) is not found. It could come also from one of the depenedency of DLL (a) with DLL (b). All DLL and test application are in the same directory. I do not undestand why it's not working on some machine. Help ? Advice ?

          La Richesse & la Gloire ne griseront jamais que les temples

          R Offline
          R Offline
          Rajkumar R
          wrote on last edited by
          #4

          Merlin Tintin wrote:

          so I have migrate my DLL (a) with VS2005.

          Merlin Tintin wrote:

          One more thing, I cannot compile the new solution VS2005 of the DLL (a).

          both are not matching.

          Merlin Tintin wrote:

          hDLL = LoadLibrary("ReplayBox.dll");

          when failed, what the GetLastError() returned.

          M 1 Reply Last reply
          0
          • R Rajkumar R

            hDLL = LoadLibrary("ReplayBox.dll");
            if (hDLL!=NULL)
            {
            ....
            }
            else
            {
            printf("DLL not found !!!\n"); <- ERROR : GO HERE WITH VS2005 DLL !!
            }

            May be i understood wrongly, he was saying failed at loading library.

            I Offline
            I Offline
            Iain Clarke Warrior Programmer
            wrote on last edited by
            #5

            :-O Grr me. All that typing, and for nothing! Ah well... Iain.

            Iain Clarke appearing in spite of being begged not to by CPallini.

            1 Reply Last reply
            0
            • R Rajkumar R

              Merlin Tintin wrote:

              so I have migrate my DLL (a) with VS2005.

              Merlin Tintin wrote:

              One more thing, I cannot compile the new solution VS2005 of the DLL (a).

              both are not matching.

              Merlin Tintin wrote:

              hDLL = LoadLibrary("ReplayBox.dll");

              when failed, what the GetLastError() returned.

              M Offline
              M Offline
              Merlin Tintin
              wrote on last edited by
              #6

              re - thank you for your interest. My team continues to search but without success for now... 1. I have a problem to load library - not (yet) to import functions but thanks for typing Iain :) 2. Merlin Tintin wrote: so I have migrate my DLL (a) with VS2005. Merlin Tintin wrote: One more thing, I cannot compile the new solution VS2005 of the DLL (a). -> My boss has migrated the DLL on his computer and compile it. When I tried to compile his solution with VS2005, it doesn't compile. 3. Merlin Tintin wrote: hDLL = LoadLibrary("ReplayBox.dll"); when failed, what the GetLastError() returned. -> error code 14001 - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. -> not very usefull.. Regards,

              La Richesse & la Gloire ne griseront jamais que les temples

              R 1 Reply Last reply
              0
              • M Merlin Tintin

                re - thank you for your interest. My team continues to search but without success for now... 1. I have a problem to load library - not (yet) to import functions but thanks for typing Iain :) 2. Merlin Tintin wrote: so I have migrate my DLL (a) with VS2005. Merlin Tintin wrote: One more thing, I cannot compile the new solution VS2005 of the DLL (a). -> My boss has migrated the DLL on his computer and compile it. When I tried to compile his solution with VS2005, it doesn't compile. 3. Merlin Tintin wrote: hDLL = LoadLibrary("ReplayBox.dll"); when failed, what the GetLastError() returned. -> error code 14001 - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. -> not very usefull.. Regards,

                La Richesse & la Gloire ne griseront jamais que les temples

                R Offline
                R Offline
                Rajkumar R
                wrote on last edited by
                #7

                So i assume Replay.dll is produced by the compiled version (Boss').

                Merlin Tintin wrote:

                when failed, what the GetLastError() returned. -> error code 14001 - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. -> not very usefull..

                just a guess, have you installed the VC Redistribute [^]

                M 1 Reply Last reply
                0
                • R Rajkumar R

                  So i assume Replay.dll is produced by the compiled version (Boss').

                  Merlin Tintin wrote:

                  when failed, what the GetLastError() returned. -> error code 14001 - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. -> not very usefull..

                  just a guess, have you installed the VC Redistribute [^]

                  M Offline
                  M Offline
                  Merlin Tintin
                  wrote on last edited by
                  #8

                  hello everybody ! >> just a guess, have you installed the VC Redistribute [^] I have installed the VC Redistribute yes... But I found the problem. You remember DLL (b) ? That was the DLL used by my DLL (a). The guy who has compiled the DLL (b) has VS2005 SP1 ! SP1 is important because it requires some other DLL to work! So, we had to check with Dependency Walker to get the dependant DLL and the manifest to get the DLL version. With a lot of research we have finally found all DLL. That's all ! :cool: I have a last problem. I still cannot compile the VS2005 project (which is a project migrated from VS2003 by my boss). I get the following error: Error 2 fatal error C1902: Program database manager mismatch; please check your installation c:\MyProject\stdafx.cpp 1 This project compile correctly of my PC's boss. What do you think ? Thanks for you help, Regards,

                  La Richesse & la Gloire ne griseront jamais que les temples

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups