MathGroup Archive 2004

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

Search the Archive

Re: Net/Link: DLL (4)

  • To: mathgroup at
  • Subject: [mg49054] Re: [mg49007] Net/Link: DLL (4)
  • From: Todd Gayley <tgayley at>
  • Date: Tue, 29 Jun 2004 04:50:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

At 03:13 AM 6/28/2004, Peter S Aptaker wrote:
>I am using Net/Link to call my win32 DLLs.   Clearly Mathematica is creating
>the DLLImports. Is there a simply way I can access  the this created source
>code  as I need it for other .Net work and would rather not duplicate
>I have looked at DLL.m and  .. gave up!


When you use DefineDLLFunction in Mathematica, .NET/Link dynamically 
generates an in-memory assembly containing an external function 
declaration, but that is the only thing it creates--there is no real code 
generated that you would want to leverage in a .NET application. You can do 
everything that DefineDLLFunction does by simply including one equivalent 
DLLImport declaration in your VB.NET code. It's true that you could save 
yourself from having to enter that one line of code for each external 
declaration if there was a way to coax .NET into saving the 
Mathematica-generated assembly to disk, but there isn't. The assembly isn't 
created with the appropriate properties to allow it to be saved.

Once you have created and tested a DefineDLLFunction call in Mathematica, 
though, it is trivial to convert it into an equivalent external function 
declaration in C# or VB.NET--you can use the argument types exactly as they 
were written in DefineDLLFunction.

Todd Gayley
Wolfram Research

  • Prev by Date: RE: matrix times a vector
  • Next by Date: Re: Printing "The Mathematica Book"
  • Previous by thread: Net/Link: DLL (4)
  • Next by thread: Printing "The Mathematica Book"