delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/07/07/15:09:56

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <006c01bfe847$2f6c9330$0100000a@TIMYX18EWDT6RQ>
From: "Tim Prince" <tprince AT computer DOT org>
To: "Jean-Luc Vay" <JLVay AT lbl DOT gov>, <cygwin AT sourceware DOT cygnus DOT com>
References: <39611F72 DOT 7D5A4AD0 AT lbl DOT gov> <39636A9C DOT FB8DD08 AT lbl DOT gov> <3965F251 DOT 726D8AD1 AT lbl DOT gov>
Subject: Re: linking windows dll with cygwin gcc
Date: Fri, 7 Jul 2000 12:11:41 -0700
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.5600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.5600

Thanks for posting this; it could prove useful, and the best which may
be done, in spite of being less flexible than I would like.

Tim Prince
----- Original Message -----
From: "Jean-Luc Vay" <JLVay AT lbl DOT gov>
To: <cygwin AT sourceware DOT cygnus DOT com>
Sent: Friday, July 07, 2000 8:08 AM
Subject: Re: linking windows dll with cygwin gcc


> This is just the solution to my request for anybody who is interested
> to link cygwin-gcc with lahey lf95 under windows. The following
> set of commands is required
>
> lf95 -win -dll -ml msvc demofact.f90 -c
> lf95 demofact.obj -dll
> dlltool -U --def demofact.def --dllname demofact.dll --output-lib
demofact.a
>
> gcc f95_dll2.c demofact.a
>
> demofact.f90, f95_dll2.c and demofact.def are
>
> %%%%%%%%
> demofact.f90:
>         !!  subroutine : FACTORIAL_DEMO taken from Lahey examples
>         !!
>         !!      sets up the factorial demonstration and governs the
>         !!      invocation of 'factorial'
>         !!
>         subroutine factorial_demo(factorials, count)
>             dll_export factorial_demo
>             integer count
>             integer, dimension(count) :: factorials
>             integer * 4 i,factorial
>             i = 1
>             do while (i <= count)
>                 factorials(i) = factorial(i)
>                 i = i + 1
>             enddo
>         end
>
>
>         recursive function factorial(n) result(factresult)
>             integer * 4  n,factresult
>             if (n .eq. 1) then
>                 factresult = 1
>             else
>                 factresult = n * factorial(n - 1)
>             endif
>         end
>
> %%%%%%%
> f95_dll2.c: modified from Lahey examples
> #include <stdio.h>
> #include <stdlib.h>
> #include <ctype.h>
> #include <stdarg.h>
> #include <string.h>
> #include <signal.h>
> #include <limits.h>
> #include <errno.h>
> #include <math.h>
> #include <time.h>
> #include <float.h>
> #include <windows.h>
>
> HANDLE _stdin_handle;
> HANDLE _stdout_handle;
> HANDLE _stderr_handle;
>
> /*
> ** Prototypes used locally.
> */
> void ChooseFactorial(void);
> /*
> int WINAPI WinMain(HANDLE hInstance, HANDLE hPrevInstance,
>     LPSTR lpCmdLine, int nCmdShow)
> */
> int main()
> {
>     printf("debut");
>     ChooseFactorial();
>     return 0;
> }
>
>
/***********************************************************************
**
> **  This is how to define prototype for a Fortran Subroutine.
> **
>
************************************************************************
*/
> /* void __stdcall factorial_demo(long *, long *); */
> void __stdcall factorial_demo(long *, long *);
>
> void ChooseFactorial()
> {
> #define number_of_factorials 12
>     long num_of_factorials = number_of_factorials;
>  long factorials[number_of_factorials];
>  char buffer[81];
>
>     /* Note that both arguments are passed by reference, the '&' is
only
>     ** required on the scalar.
>     */
>  factorial_demo(factorials, &num_of_factorials);
>  printf("%d %d %d %d %d %d\n", factorials[0], factorials[1],
factorials[2],
> \
>     factorials[3], factorials[4], factorials[5]);
>
> }
>
> %%%%%%%%
> demofact.def:
> EXPORTS
> factorial_demo AT 8
>
>
> Jean-Luc
>
> -------------------------------------------------
> Jean-Luc Vay
> Accelerator and Fusion Research Division
> Lawrence Berkeley National Laboratory - MS 71J
> Berkeley, CA 94720, USA
> Tel: (1) 510-486-4934
> Fax: (1) 510-495-2323
> Email: jlvay AT lbl DOT gov
> -------------------------------------------------



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019