Witam, napisałem w C++ dll'ke, która udostępnia trochę ciekawych funkcji. Wczytuję ją pod C# w taki sposób:
[DllImport("mathdll.dll")]
public static extern int Potega(int a, int b);
[DllImport("mathdll.dll")]
public static extern int Kwadrat(int a);
[DllImport("mathdll.dll")]
public static extern int Dodaj(int a, int b);
[DllImport("mathdll.dll")]
public static extern int Odejmij(int a, int b);
i funkcje ładnie działają, ale czy da się to zrobić jakoś szybciej tzn. żeby nie wklepywać cały czas tej linijki z DllImport'em ? (Jak jej nie ma przy kolejnej funkcji to mam błąd podczas debugowania).
Cannot intercept exception. Debugged program can not be continued and properties can not be evaluated.
System.TypeLoadException: Nie można załadować typu 'testdll.Program' z zestawu 'testdll, Version=1.0.5297.26280, Culture=neutral, PublicKeyToken=null', ponieważ metoda Odejmij' nie ma implementacji (adresu RVA).