64 bit 32 bit Compatible Standalone App

3 次查看(过去 30 天)
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 个评论
John D'Errico
John D'Errico 2014-7-30
In general, YOU did something. MATLAB is not out to get you. Well, probably not.

请先登录,再进行评论。

采纳的回答

Robert Cumming
Robert Cumming 2014-7-30
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
  2 个评论
Salaheddin Hosseinzadeh
OH! Holy Robert! LOL
Such a relief!
Thanks for your answer Robert! If that works which is similar to what Image Analyst also suggested, then it would be great!
So, according to your answer, If I use a 32bit MATLAB in 64bit windows, then the resulted standalone app will run on both win 64 and 32 and my DLL problem will be solved as well?! If this works then I will always make standalone apps in a 64bit windows but with 32bit MATLAB so it would be both 64 and 32 bit compatible!!
I've heard about using 32bit MATLAB, but nobody talked about the resulted standalone app compatibility.
Unbelievable! I'll try it tomorrow as soon as I got a 32bit matlab on the 64bit machine and I'll let you know about the results.
Thank you so so so much experts!
:)
Salaheddin Hosseinzadeh
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

请先登录,再进行评论。

更多回答(2 个)

Robert Cumming
Robert Cumming 2014-7-30
编辑:Robert Cumming 2014-7-30
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.
  3 个评论
Image Analyst
Image Analyst 2014-7-30
Don't give up. You can install both 32 bit and 64 bit MATLAB, even both on the same computer. If it's a 32 b it DLL, you'll just need to use 32 bit MATLAB like Robert said. I have to do that with one of my programs that needs to use a DLL for which there's only a 32 bit version. Sure it would be nice if 64 bit MATLAB could use 32 bit DLLs, but it can't so we just need to figure out what to do as a workaround and get on with life.
Salaheddin Hosseinzadeh
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

请先登录,再进行评论。


Image Analyst
Image Analyst 2014-10-16
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.');
WarnUser(errorMessage);
return;
end
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;
return;
end
  5 个评论
Sean de Wolski
Sean de Wolski 2014-10-16
Computer tells you the computer architecture. I saw the comment in your getOS function that said:
% % I don't know how to detect if you're running MATLAB 32 under Windows 7/64.
mexext is how you do that.
Salaheddin Hosseinzadeh
Thanks a lot Image Analyst.
isdeployed sounds quite interesting, I can discriminate between the MATLAB session mode & deployed apps. Awesome!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by