Home:ALL Converter>Loading DLL generated by MATLAB Coder with function, that calls outer functions

Loading DLL generated by MATLAB Coder with function, that calls outer functions

Ask Time:2018-09-19T17:27:32         Author:Alexey Abramov

Json Formatter

I have a DLL file, generated by MATLAB Coder, that contains function Adjust. This functions calls for few outer functions written in outer .m files, e.g PulseFindAdapt:

function [Indexes,NoiseLogBinary,NoiseThreshold]=Adjust(NoiseLog,NoiseTime,MedianLong)%значения аргументов

NoiseLog = NoiseLog/8192;
NoiseLog=NoiseLog-my_medFilt(NoiseLog,MedianLong);
mean = 45;

[Indexes,NoiseLogBinary,NoiseThreshold]=PulseFindAdapt(NoiseLog,NoiseTime,mean,7);
end

When I try to load generated Adjust.dll file using QLibrary, I get following error:

"Cannot load library Adjust.dll: the specified module could not be found"

Here I found a suggestion, that the problem could be to load one of .dll dependencies(last post):

Problem with dependencies

I tried loading other .dll files,containing only one function without and dependencies, and it worked, so the problem isn't in using QLibrary; also tried including headers and linking .cpp files with generated code for functions(e.g PulseFindAdapt), but it didn't work. Any suggestions how to load and use such .dll?

Will appreciate any help!

Author:Alexey Abramov,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/52402550/loading-dll-generated-by-matlab-coder-with-function-that-calls-outer-functions
yy