Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 415

can avoid shared object calling wrong subroutine in another shared object?

$
0
0

Hello,

I have a C# program that calls routines in two Fortran shared objects on Linux (run under Mono on Linux, run using DLLs on Windows).  I've found a problem that if both shared objects have been loaded (doing several tasks in the program) a call to a subroutine within the first shared object tries to incorrectly access a different subroutine of the same name in the second shared object.  If only one of the shared objects is loaded (doing only one set of tasks in the program) then either shared object works fine alone.  The same Fortran source code is used on Windows and works there as two DLLs.  To correct the problem I've renamed the subroutine in the first shared object to avoid calling the wrong subroutine in the second shared object.  Needing to rename subroutines in separate shared objects is a surprise to me.

Instead of renaming subroutines, is there a more general approach to limit access to subroutines in shared objects on Linux?  Is there syntax to tell the shared object to look for the subroutine only within the same shared object, or to limit external access to just a few selected routines in the shared object?

The two subroutines with the same name do have a different signature with a different number of arguments, so it seems that finding the correct subroutine by signature is not occurring.

In Windows DLLs the "DLLEXPORT" syntax helps limit access to just the intended externally accessible subroutines in the library.  When compiling on Linux I see a message that DLLEXPORT is ignored. Not needing DLLEXPORT is also explained by Steve in this topic:

https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/270148

On Linux can any subroutine in the shared object be accessed externally?  Should I expect to need to avoid subroutines of the same name within all the shared objects used by the program?

Thank you for your help.

Regards,
Greg T.

 


Viewing all articles
Browse latest Browse all 415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>