Boost logo

Boost Users :

Subject: [Boost-users] [mem_fn] Ambiguous call to mem_fn with stdcall function
From: Conrad Scott (conrad.scott_at_[hidden])
Date: 2009-03-07 09:43:49

I'm trying to use g++ (and MinGW) to compile a win32 Direct3X program
that I've written under Visual C++. All is well (so far) except for one

I'm using the technique suggested in the Boost shared_ptr documentation
to store pointers to COM objects, which works fine under Visual C++ but
under g++ (either 3.4.x or 4.3.x) I get errors about the call to mem_fn
being ambiguous due to stdcall / non-stdcall overloading.

I can't find any references to this problem on the net so I assume I'm
doing something utterly boneheaded. Any hints would be very welcome.

For example:


#include <d3d9.h>

#include <boost/mem_fn.hpp>
#include <boost/shared_ptr.hpp>

void test_mem_fn(IDirect3DDevice9 * const device)
   boost::shared_ptr<IDirect3DDevice9> ptr(
      boost::mem_fn(&IDirect3DDevice9::Release) );

test/test_mem_fn.cpp:13: error:
call of overloaded 'mem_fn(ULONG (IDirect3DDevice9::*)())' is ambiguous

note: candidates are: boost::_mfi::mf0<R, T> boost::mem_fn(R (T::*)())
[with R = ULONG, T = IDirect3DDevice9]

note: boost::_mfi::mf0_stdcall<R, T> boost::mem_fn(R (T::*)())
[with R = ULONG, T = IDirect3DDevice9]

note: boost::_mfi::dm<R, T> boost::mem_fn(R T::*)
[with R = ULONG ()(), T = IDirect3DDevice9]

Many thanks,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at