H
Holger (David) Wagner
Hi all,
we're currently developing an application in the .NET environment that
needs to access a DLL implemented in Fortran. There is one procedure
with about 17 parameters, most of them arrays. After some trial and
error experiments, we've found out that
a) the parameters must be ordered by type, i.e. we cannot mix double,
integers and Strings (char-Arrays) - instead, we first need to put
all the float[]-Arrays and Int32[]-Arrays, and after that, all the
byte[]-Arrays
b) each byte[] parameter but the first must exist twice in our C#
representation of the DLL procedure ("DllImport... public extern
static void...")
c) we couldn't pass two-dimensional byte-arrays (byte[][]) representing
one-dimensional arrays of Strings. Instead, we're serializing these
two-dimensional arrays to one-dimensional arrays.
Doing it this way, the parameters get to the DLL as intended, and where
needed they also get back to our .NET context (in/out) - but we're a
little puzzled why this is the case...
Possibly, a) is just an artefact of not paying attention to b) (it may
be that when each byte[] parameter is given twice, float[] can be given
in between, however, since the first byte[] parameter must exist only
once, this is not very probable...)
Any ideas or pointers to documentation on this behavior? We've found
some information on p/invoke, but nothing about complex cases as the one
we are facing. Also, this behavior may be specific to Fortran DLLs...
kind regards,
david
--
Auch das geht vorüber. (Sufi-Weisheit)
Holger (David) Wagner Tel: +49 (89) 890 50 962
Dewetstrasse 1 Mobil: +49 (177) 274 12 45
D-80807 München Fax: +49 (177) 992741245
we're currently developing an application in the .NET environment that
needs to access a DLL implemented in Fortran. There is one procedure
with about 17 parameters, most of them arrays. After some trial and
error experiments, we've found out that
a) the parameters must be ordered by type, i.e. we cannot mix double,
integers and Strings (char-Arrays) - instead, we first need to put
all the float[]-Arrays and Int32[]-Arrays, and after that, all the
byte[]-Arrays
b) each byte[] parameter but the first must exist twice in our C#
representation of the DLL procedure ("DllImport... public extern
static void...")
c) we couldn't pass two-dimensional byte-arrays (byte[][]) representing
one-dimensional arrays of Strings. Instead, we're serializing these
two-dimensional arrays to one-dimensional arrays.
Doing it this way, the parameters get to the DLL as intended, and where
needed they also get back to our .NET context (in/out) - but we're a
little puzzled why this is the case...
Possibly, a) is just an artefact of not paying attention to b) (it may
be that when each byte[] parameter is given twice, float[] can be given
in between, however, since the first byte[] parameter must exist only
once, this is not very probable...)
Any ideas or pointers to documentation on this behavior? We've found
some information on p/invoke, but nothing about complex cases as the one
we are facing. Also, this behavior may be specific to Fortran DLLs...
kind regards,
david
--
Auch das geht vorüber. (Sufi-Weisheit)
Holger (David) Wagner Tel: +49 (89) 890 50 962
Dewetstrasse 1 Mobil: +49 (177) 274 12 45
D-80807 München Fax: +49 (177) 992741245