Re: Net/Link: DLL (4)
- To: mathgroup at smc.vnet.net
- Subject: [mg49054] Re: [mg49007] Net/Link: DLL (4)
- From: Todd Gayley <tgayley at wolfram.com>
- Date: Tue, 29 Jun 2004 04:50:44 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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 >effort. > >I have looked at DLL.m and .. gave up! Peter, 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