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
2014-7-30
In general, YOU did something. MATLAB is not out to get you. Well, probably not.
采纳的回答
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 个)
Robert Cumming
2014-7-30
编辑:Robert Cumming
2014-7-30
Does this question describe and answer your problem? Or is it a different issue.
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
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.
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
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!