Calling MEX function works only after Explorer restart
Show older comments
Hello everyone,
I came across a strange behavior while trying to call a mex function. Basically on the first run, the Matlab crashes, with Access Violation, then after a Windows Explorer restart, the issue is gone.
I'm using the Matlab's simple code for testing purposes.
timestwo2.c
Before Explorer restart:
After a laptop restart, start Matlab (from the Window's Start menu):

Matlab crashes with Access Violation (sample from the log with config info:
--------------------------------------------------------------------------------
Access violation detected at 2024-01-24 14:47:17 +0100
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Graphics Driver : Uninitialized hardware
Graphics card 1 : Intel Corporation ( 0x8086 ) Intel(R) Iris(R) Xe Graphics Version 31.0.101.4575 (2023-7-11)
Graphics card 2 : NVIDIA ( 0x10de ) NVIDIA GeForce MX550 Version 31.0.15.1789 (2022-12-15)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 10315996
MATLAB Root : C:\Program Files\MATLAB\R2023a
MATLAB Version : 9.14.0.2337262 (R2023a) Update 5
OpenGL : hardware
Operating System : Microsoft Windows 10 Enterprise
Process ID : 3356
Processor ID : x86 Family 6 Model 154 Stepping 4, GenuineIntel
Session Key : 6ded6121-afb7-4385-bdf4-3b430c04d44a
Window System : Version 10.0 (Build 19044)
Restart Windows Explorer via the Windows' Task Manager.
After Explorer restart
Open Matlab via the Windows' Start Menu.

other:
- behavior is similar with different Matlab 2023 versions
- behavior is similar with different mingw versions (6.3 and 8.1)
- environment variables are identical before and after the explorer restart (calling a "set" in command prompt)
Any idea, where the problem might be?
5 Comments
James Tursa
on 28 Jan 2024
How are you calling it?
Jaroslav
on 29 Jan 2024
James Tursa
on 29 Jan 2024
I mean, how are you calling the timestwo function? Can you give an example?
Jaroslav
on 30 Jan 2024
Stefan
on 30 Jan 2024
H Jaroslav,
thanks for your request - I have opened a Tech Support Case for you. We will be in touch shortly.
Best,
Stefan
Answers (0)
Categories
Find more on Startup and Shutdown 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!