Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Porting Windows loadLibrary to Mac?

Darrell
Beginner
786 Views

On the Mac, are there Fortran commands loadlibrary, freelibrary, and getprocaddress to dynamically load a user supplied C++ dynamic library? On Windows the program uses, "use kernel32" to access the WinAPI. Does it need to include a compiler option?

Is there any sample code / examples / test cases to illustrate dylibs? Can you point me to the right place in the Intel / Apple documentation for dylibs? Has anyone written a "for dummies" book on the subject? :-)

0 Kudos
1 Reply
Steven_L_Intel1
Employee
786 Views
LoadLibrary, etc. are not "Fortran commands". They are Windows operating system routines and do not exist on operating systems other than Windows. "use kernel32" is the way in Intel Visual Fortran to declare the routines so that you can call them. This does not map directly onto anything on MacOS.

On Linux and MacOS, there are usually a set of C library routines that may do some of the things you're looking for. "dlopen" is probably the one to look for. Intel Fortran does not provide canned declarations of these routines, but you can use the C interoperability features to write your own declaration.

To get started, see this Wikipedia article on dynamic loading.
0 Kudos
Reply