
Am 02.05.2016 um 23:22 schrieb Andrey Semashev:
On Tuesday, 3 May 2016 00:21:38 MSK Klemens Morgenstern wrote:
But I guess if I do that
void f(unsigned int) __asm__("f");
I'll be tarred and feathered.
Does that work with __dllimport functions?
I just tried that with gcc 5.1, that works. Though it of course is an utterly simple function. #include <boost/detail/winapi/basic_types.hpp> extern "C" { BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI GetCurrentProcess(BOOST_DETAIL_WINAPI_VOID); BOOST_SYMBOL_IMPORT void* WINAPI my_func() __asm__("GetCurrentProcess"); } int main() { std::cout << GetCurrentProcess() << std::endl; std::cout << my_func() << std::endl; return 0; } From what I understand, the __asm__ only overrides the entry point and doesn't change anything else. If you want to have some fun with that you can redirect static member functions to plain C-functions etc.