none
Exiting a 16-bit application that uses .NET RRS feed

  • Question

  • Hi,

     

    Our company still has to support legacy products written in 16-bit (MSVC 1.52).  We "thunk" from 16 to 32-bit very often without any issue.

    Recently, I have felt the need to use the nice features/classes offered by .NET and so I would load and unload (via LoadLibrary and FreeLibrary) a VC++ CLR enabled dll that will make use of .NET classes .  All works nice except when I exit my 16-bit application "hosted" under ntvdm, the 32-bit CLR dll that made use of .NET seemingly stays in memory and I cannot rename the folder from which my 16-bit app was running from as a result.

    The function FreeLibrary does return true and no matter how simplistic my usage of .NET classes may be, I cannot get it to release my folder.  If I choose to make my 16-bit app to run in a separate memory space (shortcut option) then I am able to rename my folder but I want to know if there is a different solution than this workaround.

     

    Thanks.

     

    Wednesday, October 5, 2011 3:26 PM

All replies

  • Stop Win16. It is deprecated.

    We are in post 32bit era, we are in the Win64 world/

    So migrate your Win16 app to Win32.

    regards,

    Christophe PICHAUD

    MCSD, MCSD.NET, MCTS NET 2.0

    www.christophep.com

     

     


    Christophe Pichaud
    Wednesday, October 5, 2011 4:10 PM
  • Are you using .Net 4 or earlier?

     

    Wednesday, October 5, 2011 5:54 PM
  • For this particular project, I am currently using .NET 3.5 and VS2008.  However, the whole project will be merged and "migrated" into another that uses .NET 4.0 and VS2010 after the new year.

     

    Thanks.

    Wednesday, October 5, 2011 7:01 PM
  • It's a wild guess, but have you tried rebuilding your dll in .Net 4?

    .Net versions before 4 are "sticky" in that once a process loads them, they can't really be unloaded. That's one of the reasons why the Microsoft MSI group did not recommend creating custom actions in .Net.

     

    Wednesday, October 5, 2011 7:27 PM
  • I have just tried; Unfortunately, that was not it.  As soon as I make my VC++ project "/CLR" even without any assembly reference, the problem arises.

    Thank you for the idea anyways.

    Wednesday, October 5, 2011 9:06 PM