My Win32 dll function ;
Code:
char* _stdcall pages(){
const char* p ="deneme 1";
const char* p2 = "deneme 2";
int p_len = strlen(p);
int p2_len = strlen(p2);
int toplam = p_len + p2_len + 1;
char* yeni = new char[toplam];
strcpy(yeni,p);
strcat(yeni,p2);
return yeni;
}
My C# Project;
Code:
[DllImport("dlldeneme.dll")]
public static extern string pages();
Code:
private void button1_Click(object sender, EventArgs e)
{
string cevap = pages();
listBox1.Items.Add(cevap);
}
Error Message;
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.