0

Possible Duplicate:
Have to use C# dll to call C++ dll?

This is my first program related to importing external dll to my C# code. I created a DLl (Win 32 Dynamic Link Library) from visual C++ code. Let me paste the content of .cpp and .h file:

#include...
#
using namespace std;
BOOL APIENTRY DllMain( HANDLE hModule,DWORD  ul_reason_for_call, LPVOID lpReserved)
{   
      return TRUE;
}

unsigned char* decrypt(string stringKSN, string key){ #### some code
     convert(key_new);
return key_new
}

void convert(char * a) { ## return "some_value"
}

I build the visual c++ project and it created a finalDLL.dll.Now i want to use this dll into my c# code. I searched it on google and found that we can import the dll in c# project with the help of p/invoke exports. But when i compare the sample code with the above one it was totally different.

I am not able to test whether finalDLL.dll is corrected or corrupted?

Please help me to complete my import task.

12
  • can't you simply add a reference to your DLL in C# project? Commented Dec 20, 2012 at 10:17
  • It shows me following error: A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component. Commented Dec 20, 2012 at 10:18
  • what about adding a reference to project that built the DLL ? Commented Dec 20, 2012 at 10:19
  • @CapelliC didn't got your above comment Commented Dec 20, 2012 at 10:21
  • Look at this Thread: stackoverflow.com/questions/5193243/… Commented Dec 20, 2012 at 10:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.