473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DLL with main entry point

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
7 9617
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
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
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
"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
> 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

"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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
15
by: Fred Zwarts | last post by:
In C++ execution of a program starts already before execution of main(). The initialization of static variables defined outside the scope of main is performed first. I could imagine a program where...
75
by: Beni | last post by:
I have been programming in C for about a year now. It sounds silly, but I never took the time to question why a C(or C++ or Java) program execution begins only at the main(). Is it a convention or...
6
by: Marc | last post by:
I am just starting out teaching myself C#, and I have come accross a confusing point in my book. It seems that any class can have a Main() function, but what does that mean? Is the Main() function...
37
by: Spidey | last post by:
How can to write a c program without a main() so i can compile and run it
4
by: chandu | last post by:
Hello, I had one doubt,please clarify it. Main is the entry point for the application. if i had multiple overloaded main methods in my application. how the compiler recognizes the original...
5
by: PencoOdStip | last post by:
Do i have to have a main function? If i don't have a function called main,i get erors.Why do i have to have a function called main?
37
by: nick | last post by:
Does anyone know the file where the main function is defined? thanks
17
by: mariz | last post by:
hi , i m a new member to this group . i start from the beginig - main(). Can any one give me an idea for how to write a program in C without using main() ? ie while looking source code it wont...
1
by: nicolas.hognon | last post by:
Hello, With non CLR C++ I am used to have a static library (MyMain.lib) which defines the main entry points depending on the plateform (windows, unix, mac os x, ps3, ...). We are planning to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.