[MPlayer-dev-eng] symbol mangling prob on win32

Michael Niedermayer michaelni at gmx.at
Fri Jan 18 03:14:13 CET 2002


Hi

On Friday 18 January 2002 00:41, Felix Buenemann wrote:
> On Thursday, 17. January 2002 01:39, you wrote:
> > > What do you think, is the best way to handle the problem (var in inline
> > > asm
> >
> > best way? ... destroy M$ & win32 :))))
> > alternative way:
> > #ifndef __CYGWIN__
> > #define MANGLE(a) #a
> > #else
> > #define MANGLE(a) "_" #a
> > #endif
> > asm volatile("movq "MANGLE(bFF)", %%mm0;":::"memory");
> >
> > its still ugly but less so imho
>
> IMHO it must be:
IMHO RTFM ;)

#define MANGLE1(a) #a
#define MANGLE2(a) "#a"

main(){
	printf("begin"MANGLE1(foo)"end\n");
	printf("begin"MANGLE2(bar)"end\n");
}
outputs:
beginfooend
begin#aend

> > #ifndef __CYGWIN__
> > #define MANGLE(a) "#a"
> > #else
> > #define MANGLE(a) "_#a"
> > #endif
> > asm volatile("movq "MANGLE(bFF)", %%mm0;":::"memory");
>
> I mean that inserted var name must be quoted or gcc will spit a syntax
> error. "movq ""bFF""..." is ok but "movq "bFF"..." is not.
#define MANGLE1(a) #a
MANGLE1(foo) -> "foo"

Michael



More information about the MPlayer-dev-eng mailing list