I'm trying to create a small .dll
which will be able to cancel process by sending CTRL+C signal to that process.
And I'm exporting my function like this:
[DllExport("StopProgram")]
public static void StopProgram(int processId)
Here is the full source code: https://github.com/maifeeulasad/SIGINT-APP/blob/210561ed4e49d89321ed4d82627ac162fbf69c32/SendCtrlC.cs
Here I'm using this library: https://github.com/3F/DllExport. It has the most stars on GitHub and most download NuGet as of my knowledge.
But when I'm creating a small .NET console application to test, and trying to invoke function exported, it's throwing an error saying: System.EntryPointNotFoundException: 'Unable to find an entry point named 'StopProgram' in DLL 'SigInt-CtrlC.dll'.'
Here is my relavant code:
[DllImport("SigInt-CtrlC.dll")]
static extern void StopProgram(int processId);
StopProgram(pid); // <----- the error is being thrown here
Here is the reference to the exact .dll
: https://github.com/maifeeulasad/SIGINT-APP/blob/94ea0d9db757649ba190fd0dca36a65e1a17a784/bin/Release/netstandard2.0/SigInt-CtrlC.dll
Please note
- I've copied the generate
.dll
both is root source folder where all my source code lies and also in the debug folder where the.exe
build and other.dll
s being generated. - I'm also working on the same device.
So there should be no system difference issue
I've tried opening it into dependency walker 2.2, it gives me some error saying that it has some missing deps. Then I read this thread: https://stackoverflow.com/a/36244483/10305444, and stopped debugging the .dll
You can either give me a fix to to import it properly, or export it.