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

Def files and exporting functions

galatyp
Beginner
1,441 Views

i've a function in a module which i want to export. till now, i was using dllexport method. but this method works well on functions that are not in a module. i noticed that module functions are exported with a prefix of the module name (like modname..functionname) this is not sth. idesire.

ifmay i give an example;

Code:
function Add(x,y)
!DEC$ ATTRIBUTES DLLEXPORT::Add
implicit none
	integer(4) :: x,y,Add
	Add=X+y
end function 

module modSample

contains
	function Minus(x,y)
	!DEC$ ATTRIBUTES DLLEXPORT::Minus
    	implicit none
		integer(4) :: x,y,Minus
		Minus=x-y
	end function 	

end module 

when i compile this dll, and have a look in it with dependency walker, i see that two functions are exported,

Add

modSample..minus

how can i change the name of "modSample..minus" to only "minus"

any help would be appreciated. thanks in advance

0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,441 Views
!DEC$ ATTRIBUTES ALIAS:"MINUS" :: MINUS

You may want to add "decoration" (leading underscore) as required by whatever is calling the routine.
0 Kudos
galatyp
Beginner
1,441 Views
dear sblionel;
Could you please give a.def samle for the same project ?
0 Kudos
Steven_L_Intel1
Employee
1,441 Views
Why a .def file? Using the attributes is better. You'll need the ALIAS attribute anyway. It's not clear what you want from a .def file.
0 Kudos
galatyp
Beginner
1,441 Views
I want .def file because i've lot's of functions to edit (100+). With a .def file it may be easier to determine the exported functions.
0 Kudos
Steven_L_Intel1
Employee
1,441 Views
You can read about the syntax of .def files in the MSDN documentation. I think you would do something like:

EXPORTS
ADD=MODULENAME_mp_ADD

but you'll have to experiment to see if you get the right effect.
0 Kudos
Reply