locked
Preparing configuration for mixed 32 and 64 bit images (DLLs) RRS feed

  • Question

  • I have two questions:

    1)  In my port to 64 bit, I have not removed any of the compiler defines in the configuration, such as "WIN32" and others.  I don't think these should be removed, correct?

    2) With my RPC client/server system and I pretty much concluded I can recompile a set of 64 bit RPC server images, EXEs, LIBs and DLLs and 32 bit RPC client images EXEs, LIBs and DLLs.  With the exception of a few cases, the separation is such that I can keep the same installation folder.   But there are few instances where the RPC Interface SDK/API DLL files (wcsrv.dll, wciphlpapi.dll) may need to be done into two sets of libs and dlls:

    wcsrv.dll, wciphlpapi.dll   (32 bit)
    wcsrv64.dll, wciphlpapi64.dll  (64 bit)

    It sounds like a simple setup, but it actually more complicated than I thought in properly preparing this.  When I changed the IDE the  Linker default output 

    $(OutDir)$(TargetName)$(TargetExt)

    to 

    $(OutDir)$(TargetName)$(PlatformArchitecture)$(TargetExt)

    the IDE complained that the Linker output did not match other settings.   

    So I am wondering what would be the better way to handle this considering that an SDK would need to take into account 32 bit and 64 bit client development with different libaries and DLL linkages.

    Right now, we document using a pragma:

    #pragma comment (lib, "wcsrv.lib")

    That would have to change to:

    #ifdef _WIN64
    # pragma comment (lib, "wcsrv64.lib")
    # pragma comment (lib, "wciphlpapi64.lib")
    #else
    # pragma comment (lib, "wcsrv.lib ")
    # pragma comment (lib, "wciphlpapi.lib")
    #endif

    Is this the best approach for a mix 32/64 bit compiling and SDK environment?

    Thanks


    Hector Santos, CTO Santronics Software, Inc. http://www.santronics.com

    Monday, March 18, 2019 2:25 PM

Answers

  • Thanks Darran.  Thanks for a your input.  There are a number of well known packages that do have a xxxxx32.dll/lib and xxxxx64.dll/lib setup, i.e. OpenSSL and Mysql to name a few.   I still have to study what is best for us.

    The answer to my setup question is in the Configuration | General settings where the TargetName field/macro is set to: 

    $(ProjectName)$(PlatformArchitecture)

    

    The same was done for the Release|Win32 setup and it worked to create the 32/64 lib/dll files.   I can't say it will remain that way.  Just exploring to see how it works. :)  In the end, its going to be how the installation is done with a mixed RPC client32/server64 production.

    Thanks

    Hector Santos, CTO Santronics Software, Inc. http://www.santronics.com

    • Marked as answer by hector santos Tuesday, March 19, 2019 2:08 AM
    Monday, March 18, 2019 10:58 PM

All replies

  • The generally used way is to separate by directory rather than rename files.

    Since a 64 bit DLL could only ever load into a 64 bit process, and a 32 bit DLL could only ever load into a 32 bit process, there is no real need to keep these side by side.

    What's more, when you register the endpoints, there should be separate endpoint registrations for 32 bit and 64 bit, so they can have the same names but reside in different directories.

    If you look around, this is the choice made by almost everything, Windows uses System32 for 64 bit libraries and SysWow64 for 32 bit libraries (obvious, right), the registry is split so that the Wow6432node is for the 32 bit registry entries and the main portion is for the 64 bit entries. There is Program Files for 64 bit applications and Program Files (x86) for 32 bit.

    If you look on other operating systems, Linux did the same thing, there are bin64 and bin directories for applications, lib64 and lib directories for libraries and so on.


    This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Monday, March 18, 2019 6:36 PM
  • Thanks Darran.  Thanks for a your input.  There are a number of well known packages that do have a xxxxx32.dll/lib and xxxxx64.dll/lib setup, i.e. OpenSSL and Mysql to name a few.   I still have to study what is best for us.

    The answer to my setup question is in the Configuration | General settings where the TargetName field/macro is set to: 

    $(ProjectName)$(PlatformArchitecture)

    

    The same was done for the Release|Win32 setup and it worked to create the 32/64 lib/dll files.   I can't say it will remain that way.  Just exploring to see how it works. :)  In the end, its going to be how the installation is done with a mixed RPC client32/server64 production.

    Thanks

    Hector Santos, CTO Santronics Software, Inc. http://www.santronics.com

    • Marked as answer by hector santos Tuesday, March 19, 2019 2:08 AM
    Monday, March 18, 2019 10:58 PM
  • hi Hector,

    I'm glad to hear that you got it working.

    Thank you for sharing your solution here. It will be very beneficial for other community members who have similar questions.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, March 19, 2019 8:48 AM