By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,769 Members | 1,625 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,769 IT Pros & Developers. It's quick & easy.

DLL with main entry point

P: n/a
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

May 19 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
How does it know that your class contains the entry point? Most of the
time, Main is declared as static. Perhaps that will work.

May 19 '06 #2

P: n/a
err, i meant the base class to have static main...

sorry :)

Mythran

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
How does it know that your class contains the entry point? Most of the
time, Main is declared as static. Perhaps that will work.


May 19 '06 #3

P: n/a
Static methods are not inherited. You also should not define entry point in
a dll. What do you want to achieve?

"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:eB**************@TK2MSFTNGP02.phx.gbl...
err, i meant the base class to have static main...

sorry :)

Mythran

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
How does it know that your class contains the entry point? Most of the
time, Main is declared as static. Perhaps that will work.

May 19 '06 #4

P: n/a
"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote:
public void Main(string[] Args)
Main must be static for it to be an entrypoint, AFAIK.
so...theoretically..still..shouldn't it work?


In theory, no, because it isn't static.

-- Barry

--
http://barrkel.blogspot.com/
May 19 '06 #5

P: n/a
> 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.
May 19 '06 #6

P: n/a

"Barry Kelly" <ba***********@gmail.com> wrote in message
news:hi********************************@4ax.com...
"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote:
public void Main(string[] Args)


Main must be static for it to be an entrypoint, AFAIK.
so...theoretically..still..shouldn't it work?


In theory, no, because it isn't static.

-- Barry

--
http://barrkel.blogspot.com/


Yeah, I meant for it to be static :P

Mythran

May 19 '06 #7

P: n/a

"Lebesgue" <le******@gmail.com> wrote in message
news:Oh****************@TK2MSFTNGP02.phx.gbl...
Static methods are not inherited. You also should not define entry point
in a dll. What do you want to achieve?

"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:eB**************@TK2MSFTNGP02.phx.gbl...
err, i meant the base class to have static main...

sorry :)

Mythran

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
How does it know that your class contains the entry point? Most of the
time, Main is declared as static. Perhaps that will work.



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

May 19 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.