calling a function in another dll
Tayfun Cakirtas
tayfuncakirtas@gmail.com
Sat May 28 21:23:00 GMT 2005
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 :)
More information about the Fortran
mailing list