Error: This operation is only valid in the context of an app container
12 views (last 30 days)
Show older comments
I am trying to load a .dll into matlab using the loadlibrary function.
I have used it before for a different .dll and it worked fine.
I am getting the following error:
Error using loadlibrary
There was an error loading the library
"C:\Users\rhybart\Documents\MATLAB\OnLineInterface64.dll"
This operation is only valid in the context of an app container.
Error in DataLogInit (line 7)
[notfound,warnings]=loadlibrary('OnLineInterface64.dll', 'OnLineInterface64.h');
Caused by:
Error using loaddefinedlibrary
This operation is only valid in the context of an app container.
Loading the same file works fine for someone in my lab with the same version of MATLAB.
Any ideas what may be causing this?
Code below:
% Load DataLog interface library
% If already loaded, unload first: unloadlibrary OnLineInterface;
%unloadlibrary OnLineInterface64;
addpath('C:\Users\rhybart\Documents\MATLAB'); % will need to be changed
clear; % just in case library has outstanding objects.
if ~libisloaded('OnLineInterface64') % only load if not already loaded
[notfound,warnings]=loadlibrary('OnLineInterface64.dll', 'OnLineInterface64.h');
end
libfunctionsview('OnLineInterface64') % Open a window to show the functions available in the library
feature('COM_SafeArraySingleDim', 1); % only use single dimension SafeArrays
feature('COM_PassSafeArrayByRef', 1);
1 Comment
javier pina
on 11 Mar 2021
Edited: javier pina
on 15 Mar 2021
Hi,
I'm getting the same error and it is an operating system error (i assume that you are using Windows). In my case, i tried to load a .dll file on a Windows laptop and it worked fine. But when i tried on a Latte Panda (Windows 10 development board) which is basically a Windows 10 computer, this error arose.
Have you tried to load this library on another device? I suppose it could be an specific tool missing in your computer such as a compiler or even the Windows version itself.
By the way, are you using the Biometrics Twin-axis goniometers? telling by the library name and the example code. If so, i am using the same equimpent and trying to do the same as you, but on the Latte Panda i mentioned before.
I'll post here any soution i get to.
Answers (1)
javier pina
on 22 Mar 2021
The problem is the operating system (at least it was for me) i tried to load this library (assuming that you are using the goniometers i mentioned) on a Windows 10 Home. When i switched to W10 Pro or W10 student the problem went away.
Hope it helps.
0 Comments
See Also
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!