I am trying to call a Dll compiled in C++ from my .net Class Library(Compiled in 4.7.2) :
public static IntPtr dialoutHandle;
dialoutHandle = (IntPtr)null;
dialoutHandle = DialOut.dialit(phonenumber, IPAddress, encryptionFlag, PPP_USERNAME, PPP_PASSWORD, error_string, error_code);
[DllImport(DLLPath)]
public static extern IntPtr dialit(string phone_number, string ip_address,
bool encryptionFlag, string user_name, string password, [MarshalAs(UnmanagedType.LPStr)] StringBuilder error_string,
[MarshalAs(UnmanagedType.LPStr)] StringBuilder error_code);
This value returned in Dialouthandle is different in the version of .net 4.7.2 & 4.0
The value returned in 4.0 is something like "467650064" //Notice the number of digits in the Value returned.
But the value returned in 4.7.2 is like : 2147483647 //Notice there are 10 digits in the value
If the value returned is similar to the value returned fro .net version 4.0,I am able to execute the rest of the code using the dialuphandler. But in case of 4.7.2 it gives me an error later.
I tried creating a different class library in .net 4.0 and called in my parent class but that also did not work.