473,546 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

entry point

Hi all,
I would like to know whether we can specify another function instead
of main as entry point.
Thanks
Aneesh
Nov 13 '05 #1
6 4288
aneesh wrote:
I would like to know whether we can specify another function instead
of main as entry point.


Aneesh...

I must be missing something. The file containing main need not be
named main.c - main /is/ how you specify the executable's entry
point. If you want some other function than the one you called
main to be the primary entry point, then just rename the current
main to something else and call the other function main.
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c

Nov 13 '05 #2
Morris Dovey <mr*****@iedu.c om> scribbled the following:
aneesh wrote:
I would like to know whether we can specify another function instead
of main as entry point.
Aneesh... I must be missing something. The file containing main need not be
named main.c - main /is/ how you specify the executable's entry
point. If you want some other function than the one you called
main to be the primary entry point, then just rename the current
main to something else and call the other function main.


Where did you see Aneesh mention main.c?

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"The question of copying music from the Internet is like a two-barreled sword."
- Finnish rap artist Ezkimo
Nov 13 '05 #3
Joona I Palaste wrote:
Morris Dovey <mr*****@iedu.c om> scribbled the following:
aneesh wrote:
I would like to know whether we can specify another function instead
of main as entry point.

Aneesh...

I must be missing something. The file containing main need not be
named main.c - main /is/ how you specify the executable's entry
point. If you want some other function than the one you called
main to be the primary entry point, then just rename the current
main to something else and call the other function main.

Where did you see Aneesh mention main.c?


Joona...

Nowhere; but suggested as a possibility by the wording of the
question. Do you think I reached too far in trying to understand
where the question was coming from?
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c

Nov 13 '05 #4
On 30 Jul 2003 02:34:56 -0700
an********@hotm ail.com (aneesh) wrote:
Hi all,
I would like to know whether we can specify another function instead
of main as entry point.
Thanks
Aneesh


Yes, we can, but how it's done is linker-specific. Arguments -e and --entry for
the GNU linker, for example. Try the newsgroup for your compiler, or read
it's documentation.

--
main(int c,char*k,char*s ){c>0?main(0,"a dceoX$_k6][^hn","-7\
0#05&'40$.6'+). 3+1%30"),puts(" "):*s?c=!c?-*s:(putchar(45) ,c
),putchar(main( c,k+=*s-c*-1,s+1)):(s=0);r eturn!s?10:10+* k;}
Nov 13 '05 #5
aneesh wrote:
Hi all,
I would like to know whether we can specify another function instead
of main as entry point.


Not in a hosted environment, which is what you are probably using. In a
freestanding environment, the required "designated function" to be
executed at start-up need not be named "main," although it often is.

Nov 13 '05 #6
Pieter Droogendijk wrote:
On 30 Jul 2003 02:34:56 -0700
an********@hotm ail.com (aneesh) wrote:
Hi all,
I would like to know whether we can specify another function instead
of main as entry point.
Thanks
Aneesh

Yes, we can, but how it's done is linker-specific. Arguments -e and --entry for
the GNU linker, for example. Try the newsgroup for your compiler, or read
it's documentation.


Er...

On GNU/Linux the default entry point for an ELF executable is named
_start, which is library function contained in libgcc_s (or sometimes
libc on older systems). _start hoiks the command and arguments out of
the OS-defined ABI positions and reformats them to the correct C ABI
positions for argc, argv (and argp, but lets not talk about that), then
calls main.

A similar bit of sysabi-specific code deals with the return vale of main
(or the argument ot exit()), it's usually called _exit.

So in fact, yes you can define the entry point to any symbol you desire,
_but_ you will be replacing _start and not main, and you almost
certainly don't want to do that.

I'd personally go for either a wrapper main function, or quicker but
dirtier, adding -Dmyfun=main to the preprocessor flags (CPPFLAGS).

Phil

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2428
by: Sam Fields | last post by:
I have found very little regarding the error "Unable to find an entry point named EnumerateSecurityPackagesW in DLL security.dll. ". I have an ASP.NET Web Service being accessed via SSL. I found a website indicating that if any of your .dll names are security.dll, it could cause this issue. I happened to have named the service that -- so I...
1
1613
by: I am Sam | last post by:
Hi Everyone, I am new to Server control development and I am wondering how do I define the entry point for a server control? In a regular page you define Page_Load as an entry point and in a windows application using C# you define the entry point as void Main(){}. But in a Server control I think it is seperate then writing the entry point...
1
3523
by: TRI_CODER | last post by:
I am trying to solve the following exception. The exception occurs when my ASP.NET code behind code attemtps to access a remore site using SSL. Please note that all certificates are valid and the remote site is trusted. Also, my web site uses a custom HTTPModule implemented in a DLL named Security.dll. Unable to find an entry point named...
5
3142
by: Mike in Santa Rosa | last post by:
I'm trying to get a simple c# app built that can launch/manipulate an excel workbook, sheet. I've chased down several examples and can't any of them to work. So I must be doing somethnig obviouslt wrong. Most examples to get things started include something: using Microsoft.Office.Interop.Excel; or using Excel; or using Excel =...
2
6788
by: bboule | last post by:
Hi I have developped a dll that I want to use in another program ! here is my code : using System; using System.Collections.Generic; using System.Text; namespace NameSpace
10
4149
by: Lung.S.wu | last post by:
Hi all, It is a history question. Recently, I read the book "C A reference manual, third edition". In this book, it list all C language keyword, and one is "entry". I know it is omitted from ANSCI C, but I hope I can find any data about it. Doea any one know how to use it, before?
3
5646
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I am a developer from C++ COM to C# COM. I feel confused about the entry point function for a C# COM object. In C++, we always initialize object through GetClassObject or DLLGetClassObject, but it seems C# does not need these functions? Here is a sample from MSDN.
2
1830
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I am implementing a simple C# OLE DB Provider (C# COM Server). For C# (managed code), I am wondering what is the entry point (which coclass and which method), client will invoke at first? It is clear if I write my own client, but I am confused about other clients which I do not have source codes, for example, if I use...
0
1594
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I have built MSDN OLE DB Sample Provider and successfully built/debug it using Microsoft Excel as client. I have found that in DllGetClassObject (classfac.cpp), the class SampProv is initialized as the 1st coclass, then DataSource object will be created in QueryInterface. ...
5
3966
by: Premkumar | last post by:
a.cpp ---------------------------------- #include <iostream> using namespace std; void mymain() { cout<<"my-main"<<endl; } ----------------------------------
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7792
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.