DLL with main entry point

  • Thread starter Thread starter Mythran
  • Start date Start date
M

Mythran

Hmm, just for my test applications, I want to create a dll that has a class:

public class MyTest
{
[STAThread()]
public void Main(string[] Args)
{
... blah ...
}
}

I want to inherit this class in a Console application, and not have a main
entry point defined. Obviously, this goes against having an application (no
entry point), but still, theoretically, it does have an entry point defined
in the base class...so...theoretically..still..shouldn't it work?

Thanks,
Mythran
 
How does it know that your class contains the entry point? Most of the
time, Main is declared as static. Perhaps that will work.
 
Static methods are not inherited. You also should not define entry point in
a dll. What do you want to achieve?
 
in the base class...so...theoretically..still..shouldn't it work?

No, but you can do it the other way... instead of a DLL, make it an EXE. You
can still reference the assembly from other assemblies.

A use of this could be that when executed the code can display information
about itself.
 
Lebesgue said:
Static methods are not inherited. You also should not define entry point
in a dll. What do you want to achieve?

For testing, I have a solution with 3 projects...a C# DLL, C# Console, and
VB Console. I have a base class in the C# dll that both console apps' class
derive from. I see that static methods aren't inherited so theoretically,
my theoretics are messed up :)

Thanks,
Mythran
 
Back
Top