How to change the function name when export it to SO

How to change the function name when export it to a shared object file under LINUX operation system. I used CVF to compile my code before, and I can use
" !DEC$ ATTRIBUTES DLLEXPORT, ALIAS: ‘newfuncname’ :: funcname " to change the export symbol. Could you tell me how to do such things using pgf90 under LINUX?
Thanks very much.

Perhaps another user might have a better answer but I believe the linker (ld) achieves this functionality using “weak” references. Unfortunately I don’t feel I can explain weak references well enough, but if you don’t mind doing some research, I do believe this is the right direction.

In C the weak pragma:

#pragma weak newfunc = func

indicates to the linker that newfunc is a weak reference to func. There is no coresponding Fortran directive so you’d need to create an assembly file using the “-S” flag, add your “.weak” labels, and then continue by linking the assembly file.

  • Mat

Thanks alot.
I’ll try it following your way.