This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

calling a function in another dll


Hi all;

I want to call a function which is in a dll written with PowerBasic.
Suppose this function is;

Sub TestFunction (sText As String) Export
    sText="PbDll"
End Sub

i want to call this function from a fortran code like below.
__________________________________________
PROGRAM TestProgram 
CHARACTER(10) :: Text
  Call TestFunction (Text)
  WRITE (*,*) Text ! Supposed to write "PbDll" to the console
END PROGRAM
__________________________________________

i've prepared a TestDll.def (definiton) file for the dll like below;
__________________________________________
LIBRARY		"TestDll.DLL"
EXPORTS        
                TESTFUNCTION         @1

__________________________________________

then at last i've created a TestDll.lib file via lib /def:PbDll.def 

(lib is VC 6.0 lib. this is the microsoft way of creating lib file for
linking as far as i know)

i tried to compile the above Fortran code;

gfortran -o TestProgram.Exe -o PbDll.lib TestProgram.f95

but it's not compiling. I'm really stucked, can anyone please help me ?

Any help will be greatly appreciated :)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]