This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
calling a function in another dll
- From: Tayfun Cakirtas <tayfuncakirtas at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Sun, 29 May 2005 00:23:38 +0300
- Subject: calling a function in another dll
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ZiCV90U7L4cfBiRDQDnlhmiMsfAsqpqOJWOzMSI0yeDZFOU6uezFoCAcIQFkG/pirasJDIWGapR9pfJM7z1rxNFtG6/Rgd99U4URVQECowivrCMk13A9SV4oxUjk8ksFRa8mUqcB9Djgj88u5DPF9p/ifQe+gw1RUeahm4j/Q2M=
- Reply-to: Tayfun Cakirtas <tayfuncakirtas at gmail dot com>
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 :)