Calling a 32-bit DLL from 16-bit application ? System requirement for compiling a 16-bit C++ DLL? RRS feed

  • Question

  • We have a 16-bit PowerBuilder-5.0 application that uses a VC++ DLL that was originally compiled in 16-bit.
    Similiar DLL was availble as 32-bit version also for a 32-bit application.
    We had to modify some functions in the DLL. We were able to do so for 32-bit DLL, but we don't have the source code for the 16-bit version.

    So we tried using the 32-bit DLL with the 16-bit PowerBuilder 5.0 Client and it does seem to work.
    We are worried though that there would be some limitations to this and we might run into issues later.

    1. I would like to know what compatibility issues we may face when we try using this 32-bit DLL compiled using VC++ 2008 with a 16-bit PB 5.0 application. (what limitations we need to be aware of in 16-bit dll viz-a-viz 32-bit DLL. )

    2. If we try to compile the DLL using VC++ 1.5.2 on Windows XP, will the resultant DLL display true 16-bit behaviour. If not, what are a minimum system requirements for compiling to a 16-bit DLL?


    Tuesday, July 5, 2011 3:55 AM

All replies

  • The latest version of Visual C++ für 16 bit is Version 1.52c. This version may still be available for you if you have a MSDN Universal subsciption. With this version it should not be a problmen building your 16 bit DLL.

    There are a lot differences between 16bit DLLs and 32 bit DLLs. A 32 bit DLL does not have a LibMain and WEP. There are a lot more differences, but it is too long ago to describe this really correct. A good description is in my 2nd link.

    This MS articles may also help:



    Only as an additional hint: 16 bit is more than out of date. If the changes in this DLL are not a bugfix you should really think about converting your 16 bit power builder project and migrate at least to 32/64 bit. You should always remember that nothing of your 16 bit stuff you are using is in support and if you run into problems if your application is used on W2K, XP, Vista, 7 or 64 plattforms, there will not be any support. 


    Tuesday, July 5, 2011 6:48 AM
  • Thanks Bordon.

    But Since I do not have much option, lets say I have to go with the option of using the 32-bit DLL with 16-bit PowerBuilder application. What should I look out for ?

    Since the DLL is working with 16-bit application I am trying to understand the breakpoints where there could be failure:

    (NOTE: The 16-bit PB application is being used on Windows XP machines)

    1. I am keen to know If you can give some pointers on data-packing by 16-bit DLL vs 32-bit DLL.  Data packaging during the calls b/w the Application and the DLL is an area where I expect a breakpoint.

    2. I do have VC++ 1.5.2, so I wouldn't mind writing a thunk if thats the only option (but I would still be needing Windows 3.11 to do so). But before I build a layer over my 32-bit DLL, I would like to understand the basics of data packing in the DLLs.  




    Friday, July 8, 2011 6:56 AM
  • From my knowlede about 16 bit code accessing a 32 bit DLL (and I did this >10 years ago the last time) you has do do some code modifications in your 16 bit code.

    The easiest way would be modiying your DLL code and compiling it with V1.5.2 als a 16 bit DLL. Building the DLL itself should not be the problem. It is also no big dial using more recent versions of VC building a DLL. I remember V5.0 and 6.0 and DLL building was as easy as building an exe.

    Friday, July 8, 2011 10:33 AM