Connecting Tech Pros Worldwide Forums | Help | Site Map

Can someone please help to fix this problem?

Newbie
 
Join Date: Sep 2006
Posts: 1
#1: Sep 6 '06
Hello,
I am getting the error like "Attempted to read or write protected memory. This is often an indication that the other
memory is corrupt" when I run my C# program.

The code of my C# program is as follows.

Expand|Select|Wrap|Line Numbers
  1.  
  2. namespace retrieve 
  3.  
  4. {
  5.  
  6. class Program
  7.  
  8. {
  9.  
  10. [DllImport("DbSearch.dll")]
  11.  
  12. static extern void retrieve_contacts();
  13.  
  14. static void Main(string[] args)
  15.  
  16. {
  17.  
  18. try
  19.  
  20. {
  21.  
  22. retrieve_contacts();
  23.  
  24. }
  25.  
  26. catch (DllNotFoundException e)
  27.  
  28. {
  29.  
  30. Console.WriteLine(e.ToString());
  31.  
  32. }
  33.  
  34. catch (EntryPointNotFoundException e)
  35.  
  36. {
  37.  
  38. Console.WriteLine(e.ToString());
  39.  
  40. }
  41.  
  42. }
  43.  
  44. }
  45.  
  46. }
  47.  
The dll namely "DbSearch.dll" is a dll of a VC++ 6.0 program which I am trying to call in C#.

Can you please guide me to solve this problem. Thanks a lot in advance.



Thanks and Regards

Amogh G.R.

Reply