> >> > Is it possible to export a function from an executable (a function named
> >> > "foo", for example), but export it with a different symbol name (like
> >> > "bar")?
> >> > Basically, I would like for a shared object to be able to call the
> >> > function "bar" (for which there is no real code, only a symbol that
> >> > points to the "foo" function in the executable that loaded the shared
> >> > object).
> >> If foo is declared as int foo(int, char *), for example:
> >> int (*bar)(int, char *) = foo;
> > That does not declare bar to be a function, but rather a
> > pointer pointing to a function.
> This is true, but when you call foo, you are also dereferencing a
> function pointer (in something like a = foo(10, "blah");, the foo is
> evaluating to a pointer to the function foo, which is then implicitly
> dereferenced by the action of the () operator).
> So the net effect is very similar, with the exception that 'bar' can be
> assigned to, whilst 'foo' cannot, and the action of the sizeof and &
Yes, but that only works if the caller has defined bar as a pointer
in the included header files. If the caller has defined bar as a
function, you will get into big trouble by your approach. And you
can btw expect the direct function call to be slightly more
Kasper Dupont -- der bruger for meget tid p? usenet.