__declspec(naked) and function body size

Ilyes Gouta ilyes.gouta@gmail.com
Sat Dec 8 15:01:00 GMT 2007


Hi,

I'd like to do the following thing under Linux using GCC.

/* __declspec(naked) is Microsoft's C compiler specific. */

__declspec(naked) int function1()
{
	/* dummy stub dumped by the JIT. */

	int a = 0, b = 1;
	int c = a + b;

	return (c);
}
__declspec(naked) void end_function1() {}

unsigned char t[256];

void main()
{
	/* I'd like to do the following, i.e copying code around. */
	memcpy(t, function1, end_function1 - function1);
}

Is it possible using GCC? If yes, could you please tell me how?

Best regards,
Ilyes Gouta.



More information about the Gcc-help mailing list