You need specify to use the ansi format of the string, by default. it is unicode. It should be :
[DllImport("pers.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet::Ansi)]
public static extern void AddSetting(string key, string value);
Also, if the function "AddSetting" modifies the strings, you need to use StringBuilder in C#. Please refer this MSDN article for details.