I suspect that even when you tried to use StringBuilder that you declared the function as returning a String. This is a problem. The char* pointer that the unmanaged function _swe_version@4 returns will not be properly marshaled to a managed string and this is a source of the heap corruption error.
This will fail -
Public Declare Function swe_version Lib "swedll32.dll" Alias "_swe_version@4" (ByVal strVersion As StringBuilder) As String
This will succeed -
Public Declare Function swe_version Lib "swedll32.dll" Alias "_swe_version@4" (ByVal strVersion As StringBuilder) As IntPtr
This will succeed -
Public Declare Sub swe_version Lib "swedll32.dll" Alias "_swe_version@4" (ByVal strVersion As StringBuilder)