Subject: Problem porting with cygwin32 using VC++
From: [email-masked] (Christopher Kline)

16 Jul 1997 19:02:23 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Original-To: [email-masked]
X-Mailer: VM 6.32 under 19.15p4 XEmacs Lucid
X-Attribution: ck
X-Mailer: Emacs 19.15p4 XEmacs Lucid with VM 6.32
Original-Sender: [email-masked]

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
"[email-masked]" with one line of text: "help".