After using the Dotnet Core on Linux to generate my DLL -- which was successful --, I tried calling it through Python with ctypes using the connection provided through DllExport -- as shown in this example here.
How to solve this issue?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices; // Calling conventions
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using RGiesecke.DllExport;
public class FormManager3
{
[DllExport("test", CallingConvention = CallingConvention.Cdecl)]
public static void Main() {
Console.WriteLine("Test");
}
...
}
cSharp = os.path.join(scriptDirectory, "legacy/bin/Debug/netcoreapp2.2/legacy.dll")
writeToCSharp = ctypes.cdll.LoadLibrary(cSharp)
writeToCSharp.test()
After running the script:
E OSError: /home/farm/Documents/project/legacy/bin/Debug/netcoreapp2.2/legacy.dll: invalid ELF header