64 bit 32 bit Compatible Standalone App

11 views (last 30 days)
Guys Thank You Very Much.
It's awesome that you share your experties on this website, it wouldn't be so helpful and useful without you, thanks for your dedication ;)
I've just created a satandalone app according to Roberts comment, and it works perfectly on Win 64 and 32.
It couldn't be any better.
Many Regards,
%% Previously Posted Problem Hello Everyone.
I have a TTi 12104 Waveform generator comes with drivers and dll file + a console C app that allows sendin simple commands to the device and make sure it's connected and responds.
Device has a single driver for both 64bit and 32bit version of windows(tested on win 7 64bit and XP 32bit), device is perfectly installed on win 7 64bit (with the same driver used for win xp 32 bit) and console app, which uses the the same 32 bi dll file, also works flawless on 7 64 bit.
So the DLL file works on both 32 and 64 bit of windows, this is I'm sure about as I tested myself.
Although when tried to load the same dll into MATLAB 64bit there was this error:
...\AWGUSB.DLL is not a valid win32 application.
How come it works in C (on 64bit win 7) but not MATLAB 64bit on the same machine and same windows?! I previously used the same device in matlab 32 bit but I can not use it in 7 64 in MATLAB, outside matlab it's fine with 64bit windows.
I attached the header file maybe that gives a clue. Thanks for your help.
  1 Comment
John D'Errico
John D'Errico on 30 Jul 2014
In general, YOU did something. MATLAB is not out to get you. Well, probably not.

Sign in to comment.

Accepted Answer

Robert Cumming
Robert Cumming on 30 Jul 2014
You can deploy a 32 bit version which will run on a 32 bit or a 64 bit computer.
You can't compile a 64 bit from a 32 bit.
Your DLL needs to be compatible with your version of Matlab.
Its perfectly fine to run a 32 bit Matlab on 64 bit windows. In such a scenario your deployed app will run on both 32 and 64 bit machines. It will be 32 bit
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 31 Jul 2014
Hi Dear Robert,
Thanks so much for your answer.
As you said, the generated standalone app with a 64machin 32bit MATLAB parents, is compatible with both version of windows!
That's so cool.
Many Regards, Sala

Sign in to comment.

More Answers (2)

Robert Cumming
Robert Cumming on 30 Jul 2014
Edited: Robert Cumming on 30 Jul 2014
p.s. I'm sure your picture has nothing to do with why you didn't get a comment/answer....
A DLL will be 32bit or 64bit (as stated in Walters answer in the link) so you wont be able to load the 32bit from a 64bit exe (i.e. your 64bit matlab).
How come it works in C and not Matlab - well thats like apples and oranges - you not comparing like for like.
You can use the DLL with 32 bit Matlab on a 64 bit computer, or you will need a 64 bit DLL.
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 30 Jul 2014
Hi Image Analyst
Thanks so much for your attention again ;)
I heard about installing a 32bit MATLAB on 64bit machine, but finally I would like to create a standalone application for 64 bit windows, Can I do that from a 32bit MATLAB?!
It's getting a bit confusing, I guess.
I made a standalone application in win xp 32bit using DLL file What I want to do is to create the same app for 64 bit Windows.
So I found a 64bit machine, with 64bit version of MATLAB on it and tried to change the dll files for other devices and create another standalone application from the 64bit machine!
I'm wondering if I need to do this at all! Maybe I can make the 64bit app in win xp 32bit instead of switching to another windows(64bit)!
Is it possible to deploy the 64bit version from matlab 32 bit?
If i install a 32bit version of MATLAB on64 bit machine, is the standalone app 64bit compatible or 32 bit?! :(
I'm in the land of unknown, hoping that u experts can help me.
Thanks a lot

Sign in to comment.

Image Analyst
Image Analyst on 16 Oct 2014
You mgiht find my GetOS() function useful. See attached.
% Returns how many bits the MATLAB version is, by calling computer(),
% AND how many bits the computer is by chekcing a registry entry.
function [operatingSystem, howManyOSBits, howManyMATLABbits] = GetOS()
As an example of where to use it, I have a script called compile.m that does the compilation. For example if I need to compile something for a 32 bit computer user, I need to make sure I'm not running 64 bit MATLAB. So my compile script has this code at the beginning:
% Make sure I'm running the 32 bit version before compiling.
[operatingSystem, howManyOSBits, howManyMATLABbits] = GetOS()
if howManyOSBits == 64
errorMessage = sprintf('You are running 64 bit Windows and you need to be running 32 bit Windows.');
promptMessage = sprintf('About to compile myApp.m\nHave you changed the startup.m file already?');
button = questdlg(promptMessage, 'Yes - Continue', 'Yes - Continue', 'No - Cancel', 'Yes - Continue');
if strcmp(button, 'No - Cancel')
edit startup.m;
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 16 Oct 2014
Thanks a lot Image Analyst.
isdeployed sounds quite interesting, I can discriminate between the MATLAB session mode & deployed apps. Awesome!

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by