gcc use __attribute__ instead of #pragma

#include <stdio.h>

#ifndef __GNUC__

void beforemain();
void aftermain();
#pragma  startup beforemain
#pragma  exit aftermain

#else

void beforemain() __attribute__((constructor));
void aftermain()__attribute__((destructor));

#endif

int main()
{
  printf("\nim inside main\n");
  return 0;
}

void beforemain()
{
  printf("\nim before the main and is executing.........!!!\n");
}

void aftermain()
{
  printf("\nim after termination of main and is executing.........!!!\n");
}

On 2010-6-30 15:52, anand verma wrote:
i tried this c code on gcc compiler.......

this code doesn't give expected output.

OUTPUT: i  m inside main

y?


--
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.

--
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to