2

I'm working on a project, that requires I call an external dll. I used VS 2012 to create the DLL (which works fine as an EXE file). But, when I try to run the dll with the code below, I get an error say "..Missing Entry Point..". I've looked, and have not found an example which clearly explains what the entry point need to look like, and how you do it in C#, not C++. Appreciate the help. Thanks.

System.Diagnostics.Process.Start("rundll32.exe", "Mydll.dll,MyMethod" + localFile);

bflow1
  • 49
  • 1
  • 9
  • 2
    C# dll's are managed dll's, not native dll's, you can't execute them directly. – Gusman Apr 27 '16 at 17:46
  • http://stackoverflow.com/questions/6138812/need-to-run-a-c-sharp-dll-from-the-command-line – Clay Apr 27 '16 at 17:52
  • I don't think you can call managed dll using Rundll32. Here are few alternate options http://stackoverflow.com/questions/6138812/need-to-run-a-c-sharp-dll-from-the-command-line – Vinod Apr 27 '16 at 17:53
  • rundll32.exe only knows about unmanaged entrypoints for a DLL. The kind that you cannot create with C#. You could with C++/CLI or an IL rewriter like Giesecke's Unmanaged Exports. There is very, very little point to that when you use the Process class, just add a reference to the assembly. – Hans Passant Apr 27 '16 at 17:54
  • If I register the dll to the registry would that allow it to run natively. And thanks guys for the help. I'm going to give the links you posted a try. – bflow1 Apr 27 '16 at 18:40
  • Why not just package the code as a .exe and run it that way? Alternatively, create a .exe that will load your .dll and invoke a method on a class that you specify on the command line. – Sean Jan 08 '19 at 16:12

0 Answers0