Я пытаюсь экспортировать функции из библиотеки классов C# (.Net Framework 4.8), чтобы позже использовать их в проекте Delphi.
Часть C#:
Код: Выделить всё
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ClassLibrary1
{
public class Class1
{
[DllExport (CallingConvention = CallingConvention.StdCall)]
public static void Init()
{
MessageBox.Show("Hallo von testprogramm c#");
}
}
}

В Visual Studio я включил «Отладку собственного кода» в настройках проекта.
Я компилирую в режиме «Отладка», поэтому генерируются символы отладки (рядом с DLL я вижу файл .pdb).
Часть Delphi:[/b]
Код: Выделить всё
procedure TestDLL();
var
dllHandle : THandle;
dllInit: PInit;
begin
dllHandle := SafeLoadLibrary('path\to\ClassLibrary1\bin\x86\Debug\ClassLibrary1.dll');
dllInit := GetProcAddress(dllHandle, 'Init');
dllInit();
end;
Problem
When I attach Visual Studio to the running Delphi program, Visual Studio claims that there are no symbols loaded for the DLL, and therefore I'm not able to debug the C# code.
Does anyone have any idea how to fix this? I did this sort of thing in the past and never had this kind of problem.
Источник: https://stackoverflow.com/questions/781 ... e-in-delph
Мобильная версия