CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Posts
    131

    16 bit dll's with 32 bit programs

    I would like to use some 16 bit dll's (originally developed with Borland 3.5) with 32 bit programs running on windows NT. I understand that for win 98 I can use a 'Flat' Thunk but is not available for NT. What is the best way to use these dll's. The code is very complex and extensive and would be a year or so to rewrite.

  2. #2
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    Why not just rebuild the 16-bit DLLs into 32 bit DLLs if you have the source code? You don't have to bother with thunking then. You'd be surprised how little you have to change when 16-bit code is passed through a 32-bit compiler.
    Succinct is verbose for terse

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449
    I agree with cup. Why not just recompile the code with a 32-bit compiler and see how things work out? The thing that you need to watch out for in your code are

    a) assuming that int's are 16-bits. In 32-bit programming int's are 32-bits.

    b) Some windows messages such as WM_COMMAND process the WPARAM and LPARAM differently between 16 and 32-bit Windows. Most of the time, it is that HWND's are 32-bit values instead of 16-bit values.

    c) Assembly language designed for 16-bit OS. This will need a rewrite since 16-bit OS-dependent assembly language cannot be directly ported to 32-bit programming (for example, interrupts, direct I/O control, etc.)

    There is no need for a total rewrite of your code if you take care of the items listed above. Except for item c), the only thing that you need is a debugger and patience, fixing the int and message handling problems and correcting them.

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Sep 2000
    Location
    Antwerp, Belgium
    Posts
    101
    very true,

    i once did a porting of a suite of several apps from 16 to 32 bits
    didn't have much problems, the problems i mostly had where due to:
    bugs that didn't show up in 16 bit but showed up in 32 bit (easily fixable)
    exotic controls used from third party 16 bit dll's, for which i made the equivalents using standard 32bit controls (Tree, List and such)

    i think i had just 1 problem where wraparound was assumed because int used to be 16 bit

    so it's not hard at all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured