Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Net/Link: Problem with DLL (2)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48918] Re: [mg48888] Re: Net/Link: Problem with DLL (2)
  • From: "Peter S Aptaker" <psa at laplacian.co.uk>
  • Date: Wed, 23 Jun 2004 02:51:18 -0400 (EDT)
  • References: <200406220931.FAA10242@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

After more reading and experimenting have now got something 'working' but
have some more questions:

My Fortran DLLs are imported to Excel via VBA (see below).   I have tried to
use the 'self documenting VB format for clarity but have
only beem able to preserve it precisely for Double scalars as:

(1) Comment: To get Int32 I have replaced Long by long;  I recall  .Net has
longer
default Integers.

(2) Comment: the OUT array "second from last arg" seems to only be
possible with Double[].

(3) Question: .. How can I make this a two dmensional array OUT. As you will
see I currently use a 1-D array and
Partition[]?

(4) Comment: the OUT "last arg" seems best as,  out int ;  as the  manual
suggests.

I guess this hybrid style is a mess but it was hard getting it working!

Note that a real DLL would be needed to actually test this

Mathematica
=========
In[407]:=
Clear[psaInductanceDLL, psaInductancedll];
psaInductancedll =
DefineDLLFunction["psaMagIndMr2", "maths0000.dll",
"Void", {"ByVal m As long", "ByVal rp As Double", "Double[]",
"ByVal np As long", "ByVal rq As Double", "Double[]",
"ByVal nq As long", "ByVal gpp As long", "ByVal gpq As long",
"double[]", "out int"}]

psaInductanceDLL[m_,rp_, zpl_List, rq_, zql_List, opt___Rule] :=
Module[{ores},
ores = MakeNETObject[Table[0.0, {np*nq}]];
psaInductancedll[m, rp, zpl, np, rq, zql, nq, 4, 3, ores, status];
res = Partition[NETObjectToExpression[ores] , {np}]
]
psaInductanceDLL is fast.

My VBA (i.e. VB6) delaration is:
=======================
Declare Sub psaMagIndMr3 Lib "maths0000.dll" ( _
ByVal m As Long, _
ByVal rp As Double, ByRef zpl As Double, ByVal np As Long, _
ByVal rq As Double, ByRef zql As Double, ByVal nq As Long, _
ByVal gpp As Long, ByVal gpq As Long, _
ByRef res As Double, ByRef status As Long)


Thanks

Peter Aptaker

----- Original Message ----- 
From: "psa" <psa at laplacian.co.uk>
To: mathgroup at smc.vnet.net
Subject: [mg48918] [mg48888] Re: Net/Link: Problem with DLL (2)

etc etc


  • Prev by Date: Re: Page breaks and numbers don't seem to work
  • Next by Date: Re: Sort by buried element in list
  • Previous by thread: Re: Net/Link: Problem with DLL (2)
  • Next by thread: Re: Re: Re: Net/Link: Problem with DLL (2)