lafiona commented on a change in pull request #12424:
URL: https://github.com/apache/arrow/pull/12424#discussion_r810334081



##########
File path: matlab/CMakeLists.txt
##########
@@ -305,16 +305,17 @@ target_include_directories(arrow_matlab PRIVATE 
${CPP_SOURCE_DIR})
 target_include_directories(arrow_matlab PRIVATE ${ARROW_INCLUDE_DIR})
 target_compile_definitions(arrow_matlab PRIVATE ARROW_MATLAB_EXPORTING)
 
-set(mexfcn_sources mex/mexfcn.cc)
-list(TRANSFORM mexfcn_sources PREPEND ${CPP_SOURCE_DIR}/arrow/matlab/)
+set(mexcall_sources mex/call.cc)
+list(TRANSFORM mexcall_sources PREPEND ${CPP_SOURCE_DIR}/arrow/matlab/)
 
-# Build mexfcn MEX binary.
+# Build call MEX binary.
 matlab_add_mex(R2018a
-               NAME mexfcn
-               SRC ${mexfcn_sources}
+               NAME mexcall

Review comment:
       After some investigation, I found that MATLAB performs runtime dynamic 
linking for MEX functions, and that they are loaded using their full filename, 
including the full path. This means that MATLAB is able to differentiate 
between two MEX functions, of the same name, as long as the MEX shared 
libraries are in different directories. 
   
   I tested this behavior by creating two parallel packages containing MEX 
files with the same name and different contents. After compiling both, I could 
access both in the same instance of MATLAB, on Windows, macOS, and Linux. 
   
   The name of the MEX shared library in this case is `call.<mex-extension>`. 
There should not be any collisions because there cannot be another MEX file 
with the same name, in the same package. 
   
   In the future, there are opportunities to wrap the MEX function in M-code to 
improve the API and enable input argument validation and logging as the 
supported functionality expands.
   
   I will mark the Pull Request as "ready", however, please let me know if you 
still have any concerns.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to