Re: Way to autogenerate C/C++ Headers?
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
Re: Way to autogenerate C/C++ Headers?         


Author: fj
Date: Feb 6, 2008 03:13

On 6 fév, 09:52, Arjen Markus wrote:
> On 5 feb, 22:03, nsdevelo...@yahoo.com wrote:
>
>> One thing I want to be clear about, though, is that I'm not trying to
>> convert the Fortran source to C, just create the headers so that I can
>> call the Fortran DLL.
>
> Perhaps SWIG can help you with that? I am not sure whether
> it support (modern) Fortran, but it certainly is worth
> checking.
>
> Regards,
>
> Arjen

I would like exactly the reverse program, i.e. generating a F2003
module equivalent to a C header file.

I looked for it on Internet but unsuccessfully. I could try to write
such program (in FORTRAN of course) but it would need a lot of time I
don't have for the moment.
31 Comments
Re: Way to autogenerate C/C++ Headers?         


Author: Arjen Markus
Date: Feb 6, 2008 04:09

On 6 feb, 12:13, fj wrote:
> On 6 fév, 09:52, Arjen Markus wrote:
>
>> On 5 feb, 22:03, nsdevelo...@yahoo.com wrote:
>
>>> One thing I want to be clear about, though, is that I'm not trying to
>>> convert the Fortran source to C, just create the headers so that I can
>>> call the Fortran DLL.
>
>> Perhaps SWIG can help you with that? I am not sure whether
>> it support (modern) Fortran, but it certainly is worth
>> checking.
>
>> Regards,
>
>> Arjen
>
> I would like exactly the reverse program, i.e. generating a F2003
> module equivalent to a C header file.
> ...
Show full article (0.96Kb)
no comments
Re: Way to autogenerate C/C++ Headers?         


Author: nsdevelop12
Date: Feb 6, 2008 06:05

On Feb 6, 8:09 am, Arjen Markus wrote:
> On 6 feb, 12:13, fj wrote:
>
>
>
>> On 6 fév, 09:52, Arjen Markus wrote:
>
>>> On 5 feb, 22:03, nsdevelo...@yahoo.com wrote:
>
>>>> One thing I want to be clear about, though, is that I'm not trying to
>>>> convert the Fortran source to C, just create the headers so that I can
>>>> call the Fortran DLL.
>
>>> Perhaps SWIG can help you with that? I am not sure whether
>>> it support (modern) Fortran, but it certainly is worth
>>> checking.
>
>>> Regards,
>
>>> Arjen ...
Show full article (1.59Kb)
no comments
Re: Way to autogenerate C/C++ Headers?         


Author: Damian
Date: Feb 6, 2008 06:35

On Feb 6, 3:13 am, fj wrote:
> On 6 fév, 09:52, Arjen Markus wrote:
>
>> On 5 feb, 22:03, nsdevelo...@yahoo.com wrote:
>
>>> One thing I want to be clear about, though, is that I'm not trying to
>>> convert the Fortran source to C, just create the headers so that I can
>>> call the Fortran DLL.
>
>> Perhaps SWIG can help you with that? I am not sure whether
>> it support (modern) Fortran, but it certainly is worth
>> checking.
>
>> Regards,
>
>> Arjen
>
> I would like exactly the reverse program, i.e. generating a F2003
> module equivalent to a C header file.
> ...
Show full article (1.28Kb)
1 Comment
Re: Way to autogenerate C/C++ Headers?         


Author: nsdevelop12
Date: Feb 6, 2008 09:03

On Feb 6, 10:35 am, Damian rouson.net> wrote:
> On Feb 6, 3:13 am, fj wrote:
>
>
>
>> On 6 fév, 09:52, Arjen Markus wrote:
>
>>> On 5 feb, 22:03, nsdevelo...@yahoo.com wrote:
>
>>>> One thing I want to be clear about, though, is that I'm not trying to
>>>> convert the Fortran source to C, just create the headers so that I can
>>>> call the Fortran DLL.
>
>>> Perhaps SWIG can help you with that? I am not sure whether
>>> it support (modern) Fortran, but it certainly is worth
>>> checking.
>
>>> Regards,
>
>>> Arjen ...
Show full article (1.73Kb)
no comments
Re: Way to autogenerate C/C++ Headers?         


Author: Arjen Markus
Date: Feb 6, 2008 23:40

On 6 feb, 15:35, Damian rouson.net> wrote:
> On Feb 6, 3:13 am, fj wrote:
>
>
>
>
>
>> On 6 fév, 09:52, Arjen Markus wrote:
>
>>> On 5 feb, 22:03, nsdevelo...@yahoo.com wrote:
>
>>>> One thing I want to be clear about, though, is that I'm not trying to
>>>> convert the Fortran source to C, just create the headers so that I can
>>>> call the Fortran DLL.
>
>>> Perhaps SWIG can help you with that? I am not sure whether
>>> it support (modern) Fortran, but it certainly is worth
>>> checking.
>
>>> Regards, ...
Show full article (2.62Kb)
no comments
Re: Way to autogenerate C/C++ Headers?         


Author: Arjen Markus
Date: Feb 8, 2008 00:27

Hi,

I have posted my first more or less useful version of such
an automatic wrapper generator on: http://wiki.tcl.tk/20756.

You will find the source code (in Tcl) for it and an explanation
of how it is implemented. But here is a more practical guide
for actually using it:

The C to Fortran wrapper is implemented in Tcl, so you need an
installation of this dynamic language or a run-time shell (see
below) to use it.

Instructions for use
--------------------
The wrapper can be run as follows:

tclsh cwrap.tcl header.h

Or, if you use the tclkit run-time shell:

tclkit cwrap.tcl header.h

(and type "exit" to stop the program)

It will produce the following Fortran and C files:
Show full article (2.35Kb)
no comments
Re: Way to autogenerate C/C++ Headers?         


Author: fj
Date: Feb 8, 2008 02:43

On 8 fév, 09:27, Arjen Markus wrote:
> Hi,
>
> I have posted my first more or less useful version of such
> an automatic wrapper generator on:http://wiki.tcl.tk/20756.
>
> You will find the source code (in Tcl) for it and an explanation
> of how it is implemented. But here is a more practical guide
> for actually using it:
>
> The C to Fortran wrapper is implemented in Tcl, so you need an
> installation of this dynamic language or a run-time shell (see
> below) to use it.
>
> Instructions for use
> --------------------
> The wrapper can be run as follows:
>
> tclsh cwrap.tcl header.h
> ...
Show full article (9.01Kb)
no comments
Re: Way to autogenerate C/C++ Headers?         


Author: Arjen Markus
Date: Feb 8, 2008 02:59

On 8 feb, 11:43, fj wrote:
> On 8 fév, 09:27, Arjen Markus wrote:
>
>
>
>
>
>> Hi,
>
>> I have posted my first more or less useful version of such
>> an automatic wrapper generator on:http://wiki.tcl.tk/20756.
>
>> You will find the source code (in Tcl) for it and an explanation
>> of how it is implemented. But here is a more practical guide
>> for actually using it:
>
>> The C to Fortran wrapper is implemented in Tcl, so you need an
>> installation of this dynamic language or a run-time shell (see
>> below) to use it.
> ...
Show full article (10.25Kb)
no comments
Re: Way to autogenerate C/C++ Headers?         


Author: Arjen Markus
Date: Feb 8, 2008 03:11

Apart from the BIND(C) lines in the Fortran module, I can get it
to work if:
- I remove the #ifdefs (right now completely ignored)
- I put spaces before and after the braces in the struct definition
- Oh, and I fix a small error in the Tcl code:
puts "$error" <-- the quotation mark was missing.

I will take your example as another benchmark. Thanks for this.

Regards,

Arjen

Just to give you an impression, the results are:

! Interfaces for wrapper routines (derived from xx)
!
module xx

interface
subroutine odessa_segment_initialize ( )

end subroutine odessa_segment_initialize
subroutine odessa_segment_extend ( )

end subroutine odessa_segment_extend
subroutine odessa_segment_stop ( s )
integer :: s
end subroutine odessa_segment_stop
integer function odessa_segment_create ( n, size )
...
Show full article (7.91Kb)
no comments
1 2 3 4