When I utilize “loadlibrary”to load dll file, it shows that,“Error using loadlibrary Failed to preprocess the input file.”
조회 수: 2 (최근 30일)
이전 댓글 표시
When I utilize “loadlibrary”to load dll file, it shows that,“Error using loadlibrary Failed to preprocess the input file.” ,and fails.
Does the .dll file or .h file,need to be add or delete extra codes to format?
This is my code,of which the m-file is placed with sisl.dll and sisl.h:
if ~libisloaded('sisl')
loadlibrary('sisl','sisl.h');
end
댓글 수: 0
답변 (1개)
sanidhyak
2025년 3월 6일
I understand that you are facing the error "Failed to preprocess the input file" while using “loadlibrary” function in MATLAB to load “sisl.dll”. This issue usually occurs due to missing dependencies, incorrect header file formatting, or compiler configuration problems.
You can try the following workarounds for the same:
1. Make sure that “sisl.h” is correctly formatted and contains function prototypes. You should simplify any complex preprocessing directives (“#define” macros) or provide a preprocessed version of the file.
2. You can modify the provided code as follows:
if ~libisloaded('sisl')
loadlibrary('sisl', 'sisl.h', 'mfilename', 'sisl_proto');
end
This will generate an “M-file” to assist MATLAB in handling the “DLL” functions.
3. You can check MATLAB’s compiler setup by running:
mex -setup
If no compiler is set, install a compatible one from MATLAB’s supported compilers list.
4. If “sisl.h” references other headers, manually include them using:
loadlibrary('sisl', @sisl_proto);
5. Ensure “sisl.dll” is compiled for the same MATLAB architecture (64-bit vs. 32-bit). Check for missing dependencies using:
Windows:
depends sisl.dll
Linux:
ldd sisl.dll
6. If the header file is problematic, try loading the DLL without it:
loadlibrary('sisl', '', 'alias', 'sisl');
For more details, refer to “loadlibrary” in MATLAB documentation:
I hope this helps!
댓글 수: 0
참고 항목
카테고리
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!