| Line 111... |
Line 111... |
| 111 |
of C++ I/O may or may not work, and has been seen to crash R.
|
111 |
of C++ I/O may or may not work, and has been seen to crash R.
|
| 112 |
|
112 |
|
| 113 |
To use F90 or F95, see `Writing R Extensions'.
|
113 |
To use F90 or F95, see `Writing R Extensions'.
|
| 114 |
|
114 |
|
| 115 |
For other compilers you will need to arrange to produce a DLL with
|
115 |
For other compilers you will need to arrange to produce a DLL with
|
| 116 |
cdecl (also known as _cdecl or __cdecl) linkage. The mingw port (and
|
116 |
cdecl (also known as _cdecl or __cdecl) linkage. The MinGW port (and
|
| 117 |
VC++) uses no `name mangling' at all, so that if for example your
|
117 |
VC++) uses no `name mangling' at all, so that if for example your
|
| 118 |
compiler adds leading or trailing underscores you will need to use the
|
118 |
compiler adds leading or trailing underscores you will need to use the
|
| 119 |
transformed symbol in the call to .C in your R code. Many compilers
|
119 |
transformed symbol in the call to .C in your R code. Many compilers
|
| 120 |
can produce cdecl DLLs by a suitable choice of flags, but if yours
|
120 |
can produce cdecl DLLs by a suitable choice of flags, but if yours
|
| 121 |
cannot you may need to write some `glue' code in C to interface to the
|
121 |
cannot you may need to write some `glue' code in C to interface to the
|
| 122 |
DLL.
|
122 |
DLL.
|
| 123 |
|
123 |
|
| 124 |
If you use .Fortran this appends an underscore and does no case
|
124 |
If you use .Fortran this appends an underscore and does no case
|
| 125 |
conversion at all to the symbol name. It is normally best to use
|
125 |
conversion at all to the symbol name. It is normally best to use
|
| 126 |
.C with compilers other than g77 and map the name manually if necessary.
|
126 |
.C with compilers other than gfortran and map the name manually if necessary.
|
| 127 |
|
127 |
|
| 128 |
Care is needed in passing character strings to and from a DLL by .C:
|
128 |
Care is needed in passing character strings to and from a DLL by .C:
|
| 129 |
they must be equivalent to the C type char** and null-terminated. Not
|
129 |
they must be equivalent to the C type char** and null-terminated. Not
|
| 130 |
even the mingw g77 Fortran uses null-terminated strings.
|
130 |
even the MinGW g77 Fortran used null-terminated strings. (g77 was in
|
| - |
|
131 |
GCC 3.x.y, superseded by gfortran.)
|
| 131 |
|
132 |
|
| 132 |
WARNING: DLLs made with some compilers reset the FPU in their startup
|
133 |
WARNING: DLLs made with some compilers reset the FPU in their startup
|
| 133 |
code (Delphi has been one), and this will cause operations such as
|
134 |
code (Delphi has been one), and this will cause operations such as
|
| 134 |
0./0. to crash R. You can re-set the FPU to the correct values by a
|
135 |
0./0. to crash R. You can re-set the FPU to the correct values by a
|
| 135 |
call to the C entry point Rwin_fpset().
|
136 |
call to the C entry point Rwin_fpset().
|