Re: [Mingw-w64-public] the compiler treats '__cdecl' '__stdcall' as the same.
2012/10/10 niXman i.nix...@gmail.com Hello, When I compile this simple code: void myfoo(void(__cdecl*)()){} void myfoo(void(__stdcall*)()){} int main(){} I get the following error: Assembler messages: Error: symbol `__Z5myfooPFvvE' is already defined Why the compiler treats theese two specificators as the same? I suppose you're compiling for x64, which has only one calling convention and I suppose GCC just handles both in the exact same way. MSVC ignores both on x64: http://msdn.microsoft.com/en-us/library/zkwh89ks.aspx http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx If you're compiling for x86, I don't know. :) Ruben -- Regards, niXman ___ Dual-target(32 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] the compiler treats '__cdecl' '__stdcall' as the same.
On 10/10/12, niXman i.nix...@gmail.com wrote: Hello, When I compile this simple code: void myfoo(void(__cdecl*)()){} void myfoo(void(__stdcall*)()){} int main(){} I get the following error: Assembler messages: Error: symbol `__Z5myfooPFvvE' is already defined Why the compiler treats theese two specificators as the same? Because the names of the two functions are the same, i.e. myfoo and your error is not about how __cdecl and __stdcall are treated, -- Regards, niXman -- O.S. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] the compiler treats '__cdecl' '__stdcall' as the same.
On 10/10/12, niXman i.nix...@gmail.com wrote: 2012/10/10 Ozkan Sezer: Because the names of the two functions are the same, i.e. myfoo This is a C++ code. Arguments for functions are of different types, ie overload should work. MSVC 2010 compiles this code successfully. Ah sorry, didn't notice c++ overloading. Possibly a g++ issue then? -- Regards, niXman -- O.S. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] the compiler treats '__cdecl' '__stdcall' as the same.
2012/10/10 niXman: For example, this code work as expected: templatetypename T, typename U struct is_same { enum { value = 0 }; }; templatetypename T struct is_sameT, T { enum { value = 1 }; }; int main() { typedef void(__stdcall* stdcall_func_ptr)(); typedef void(__cdecl* cdecl_func_ptr)(); return is_samestdcall_func_ptr, cdecl_func_ptr::value; } main returns 0 Ie the compiler knows that these are two different types. I guess this is a assembler bug. -- Regards, niXman ___ Dual-target(32 64-bit) MinGW compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingwbuilds/ -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] the compiler treats '__cdecl' '__stdcall' as the same.
2012/10/10 niXman i.nix...@gmail.com: For example, this code work as expected: templatetypename T, typename U struct is_same { enum { value = 0 }; }; templatetypename T struct is_sameT, T { enum { value = 1 }; }; int main() { typedef void(__stdcall* stdcall_func_ptr)(); typedef void(__cdecl* cdecl_func_ptr)(); return is_samestdcall_func_ptr, cdecl_func_ptr::value; } main returns 0 The reason why g++ isn't able to distiguish between calling-conventions for C++-function names is caused by the fact that g++ doesn't use the calling-convention within mangled C++-name. VC does this and so you have indeed two different signatures. File a bug report for g++ to gcc's bugzilla. Regards, Kai -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public