This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem porting with cygwin32 using VC++



Hello everyone,

I'm trying to use the cygwin32 library to port a Unix app over to
NT. The project is being built in VC++ 5.0, and I can't seem to get
the VC++ compiler to accept the inline assembly in the cygwin32
<asm/byteorder.h> header.

Here's the problem code:

extern __inline__ unsigned long int
__ntohl(unsigned long int x)
{
	__asm__("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
		"rorl $16,%0\n\t"	/* swap words		*/
		"xchgb %b0,%h0"		/* swap higher bytes	*/
		:"=q" (x)
		: "0" (x));
	return x;
}

Apparently this was meant for Gnu compiler suite to interpret, but
unfortunately I have to use VC++. I tried moving this over to what I
thought VC++ wanted:

extern __inline__ unsigned long int
__ntohl(unsigned long int x)
{
	__asm 
	{
		xchgb %b0, %h0	
		rorl $16, %0	
		xchgb %b0, %h0	:"=q" (x) : "0" (x));
	}
	return x;
}

but it doesn't like that either. Since I know nothing about VC++
inline assembly (and I'm new to NT and VC++), does anyone know how to
get this to work?  

Any help from Windows gurus would be GREATLY appreciated!

Thanks,
Chris
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]