I had a similar problem: Access violations caused by bad pointers after having freed a dll with FreeLibrary. Your problem sounds just the same. The problem was, the dll and the exe each had its own copy of the c-runtime-library and each c-runtime-library had its own heap. Freeing the dll also freed its heap and all dynamically allocated memory. To overcome this problem: Free memory where it had been allocated Her is the link about the 'FreeLibrary problem' where i found the answer to the problem: http://java.codeproject.com/Feature/SubtleBugs.aspx?fid=1647&msg=2660410
H
Hartwin Stuewe
@Hartwin Stuewe