On Thursday 12 August 2010 21:05:59 you wrote: > On 08/12/2010 10:29 AM, Job Noorman wrote: > > On Thursday 12 August 2010 19:10:58 you wrote: > >> On 08/12/2010 09:44 AM, Job Noorman wrote: > >>> Hi, > >>> > >>> I am trying to make a direct function call from inline assembly like this: > >>> asm("call %0" : : "i"(func)); > >>> > >>> This doesn't work because GCC will generate something like > >>> > >>> call $mangledFunc > >>> > >>> which will give an assembly error. > >>> Is there a way to do this? > >>> > >>> Thanks in advance! > >>> Job > >>> > >>> PS: I know I can do something like > >>> > >>> asm("call *%0" : : "r"(func)); > >>> > >>> But then it's not a direct call anymore. > >>> > >>> PPS: I also posted this question on StackOverflow: > >>> http://stackoverflow.com/questions/3467180/direct-call-using-gccs-inlin > >>> e- assembly > >> > >> Are you simply trying to do: > >> asm("call func"); > >> > >> That produces the assembly language (using -S option to gcc): > >> call func > >> > >> --Bob > > > > Sorry, I forgot to mention I'm using C++ and I would like to not have to > > hard- code the mangled function name. > > > > Job > > I assume that you can't declare the function as a C function? > extern "C" void func(int x); > > My simplistic answers are not meant to suggest that you lack > understanding of C++. I just know that I sometimes go down a path in my > thinking that causes me to overlook the simple solution. I'm a retired > CS Prof. and have had students ask "dumb" questions that cause me to > realize this. :-) > > --Bob Don't worry about it! It wouldn't be the first time I spent way too much time solving a way too simple problem. I'm glad you take the time to give an answer. The function I'm trying to call is a non-static class member function so I cannot declare it extern "C", unfortunately. Job