Recently me and my co-worker found a strange issue while developing something where we used a c++ dll imported from .net project. Inside the c++ dll we have used some relative paths which is needed on each operation to load resources. If we use OpenFileDialog in c# before calling the method of the c++ dll it changes the current directory and the dll not able to find the path. Here is the source code for better understanding:
OpenFileDialog opd = new OpenFileDialog();
if (opd.ShowDialog() == DialogResult.OK)
{
}
moo(@"D:\Images\DB\fao.bmp"); // moo is a method of c++ dll imported here
Above code unfortunately do not work on my co-workers machine. He is using windows xp sp3.
The fun part is that the same code works properly in my machine which is windows 7. We both used same .net framework.
In my co-worker's machine if he uses the below code it works perfectly:
/*
OpenFileDialog opd = new OpenFileDialog();
if (opd.ShowDialog() == DialogResult.OK)
{
}
*/
moo(@"D:\Images\DB\fao.bmp"); // moo is a method of c++ dll imported here
Tuesday, June 5, 2012
Subscribe to:
Posts (Atom)