How to compile and link 32 bit c code with 64 bit c code‏

Qing Wang qinggwang@hotmail.com
Tue Jan 5 03:47:00 GMT 2010


Hi, 
 
I am making a 32 bit project to call some 64 bit functions.
So, I have most of c files which will be compiled and linked into 32 bit binary.And I have some c files including those functions which will be compiled into 64 bit binary.
Of course, I will call into assembly first to set up 64 bit mode, and then call those 64 bit functions, finally I will return to assembly to get back to 32 bit mode. 
 
Now I have a problem how to compile and link those 32 bit code with those 64 bit code together into one object file (like xxx.gz) 
Unlike assembly, which is easy to embed ".code32" or ".code64" in assembly to distinguish 32 bit code and 64 bit code, (see the document "Using as The GNU Assembler"), how can I achieve this for c files? Or are there any examples to tell me to achieve this? 
 
Thanks.
Qing  		 	   		  
_________________________________________________________________
Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmailآ®.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009



More information about the Gcc-help mailing list