Re: Can you call 32 Bit DLLs from Mathematica 8.0 ?
- To: mathgroup at smc.vnet.net
- Subject: [mg125250] Re: Can you call 32 Bit DLLs from Mathematica 8.0 ?
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at ymail.com>
- Date: Fri, 2 Mar 2012 07:48:21 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jinjsa$d4v$1@smc.vnet.net>
On Thu, 01 Mar 2012 10:43:22 -0000, Guido <guido.reichert at gmx.de> wrote:
> I am using a System Dynamics software (Vensim DSS) that is still a 32
> Bit application and provides a full 32 Bit DLL for use with other
> programs. I had thought that I can call that DLL from Mathematica 8.0.
>
> Such a call produces a 'BadFormat' error and the Vensim support says
> that 64 Bit and 32 Bit do not mix well. Is there any chance to call a
> 32 Bit DLL from Mathematica 8.0?
>
> Kind regards
>
> Guido
>
Not from the 64-bit version, no; it is simply not possible for a 64-bit
Windows process to load a 32-bit DLL directly. Fortunately, both 32- and
64-bit versions of Mathematica are provided in the standard installation,
probably for exactly this reason. To help you start the 32-bit Mathematica
kernel on a 64-bit system, you can evaluate:
SetOptions[$FrontEnd,
EvaluatorNames -> Append[
EvaluatorNames /. Options[$FrontEnd],
"Local (32-bit)" -> {
"AutoStartOnLaunch" -> False,
"Executable" -> FileNameJoin[{
$InstallationDirectory, "SystemFiles",
"Kernel", "Binaries", "Windows", "MathKernel.exe"
}]
}
]
];
which adds an entry for the 32-bit kernel in the kernel configuration
options dialog, i.e. the one produced by evaluating:
FrontEndExecute@FrontEndToken["ModifyEvaluatorNames"]
With this set up, you just need to select the menu option Evaluation |
Notebook's Kernel | Local (32-bit) in a new notebook (before evaluating
anything) in order to have that notebook use the 32-bit kernel. This can
also be accomplished programmatically by evaluating:
SetOptions[EvaluationNotebook[], Evaluator -> "Local (32-bit)"]
Saving the notebook also saves the kernel configuration, so it will still
run on the 32-bit kernel when closed and re-opened.