I\'m using a VS 2005 app to interface against an unmanaged (Fortran) DLL. When I run the compiled executable straight from the command line, everything is fine - the DLL can
Might be that there is an unhandled exception. You could try to add the following code to handle all uncatched exceptions:
static void Main()
{
// Add a handler for the UnhandledExceptionEvent
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
static void CurrentDomain_UnhandledException
(object sender, UnhandledExceptionEventArgs e)
{
try
{
Exception ex = (Exception)e.ExceptionObject;
MessageBox.Show(ex.ToString(), "Error",
MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
finally
{
Application.Exit();
}
}
The reason for the underlying problem is that you might have a different working folder when debugging so that your native library is not found.