How to use Matlab DLL in other program (Delphi) ?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to implement a DLL created with Matlab in a Delphi/Pascal code. I am just testing the mechanism of DLL inegration right now so the DLL is just a fonction with two argument values and return the sum of them.
I did some researchs in the process of Matlab DLL integration and I understood that the DLL contains several functions, those I must use are (in order) mlf<dll_name (the function that calculate) and then <dll_name>Terminate.
I wrote that and launch my delphi code. Then an error report from the Matlab Runtime environment were created (see below).
Can I have more information on Matlab DLL integration ? I read that argument and return values of the DLL must be pointers and double type, is that true for all the DLL created with Matlab ?
if true
% ------------------------------------------------------------------------
Access violation detected at Wed Mar 15 15:00:53 2017
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Current Graphics Driver: Unknown hardware
Default Encoding : windows-1252
Deployed : true
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA Quadro M1000M Version 21.21.13.7306
Graphics card 2 : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 530 Version 20.19.15.4483
Host Name : HOLBYTLAN
MATLAB Architecture : win64
MATLAB Entitlement ID: Unknown
MATLAB Root : C:\Program Files\MATLAB\R2016b
MATLAB Version : 9.1.0.441655 (R2016b)
OpenGL : hardware
Operating System : Microsoft Windows 10 Professionnel
Processor ID : x86 Family 6 Model 94 Stepping 3, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 10.0 (Build 14393)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000009a8e170 RBX = 0000000000000000
RCX = 0000000000000000 RDX = 0000000000000000
RSP = 0000000009a8dee8 RBP = 0000000009a8df30
RSI = 0000000009a8e050 RDI = 0000000000000000
R8 = 0000000000000002 R9 = 0000000007777a30
R10 = 000000001e2f54d0 R11 = 0000000024fe3040
R12 = 0000000009a8e600 R13 = 00000000ffffffff
R14 = 000000000072e770 R15 = 0000000024fe3040
RIP = 00000000023cce60 EFL = 00010206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00000000023cce60 C:\Program Files\MATLAB\R2016b\bin\win64\libmx.dll+00052832 mxArray_tag::is_scalar_double_flag_set+00000000
[ 1] 0x000000000777634f C:\Program Files\MATLAB\R2016b\bin\win64\libmwlxetypes.dll+00025423 MathWorks::lxe::xvalue::MaybeInitializeOptimizedValueFromMxArray+00000047
[ 2] 0x0000000007776813 C:\Program Files\MATLAB\R2016b\bin\win64\libmwlxetypes.dll+00026643 MathWorks::lxe::xvalue::xvalue+00000051
[ 3] 0x000000000777679f C:\Program Files\MATLAB\R2016b\bin\win64\libmwlxetypes.dll+00026527 MathWorks::lxe::xvalue::CopyMxArrayToXvalue+00000019
[ 4] 0x00000000049cc020 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00704544 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00615468
[ 5] 0x0000000004ae618c C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+01859980 boost::serialization::singleton<boost::serialization::void_cast_detail::void_caster_primitive<ir::IrTree,MathWorks::utl::attachment> >::get_instance+00304720
[ 6] 0x0000000004a01b46 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00924486 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00835410
[ 7] 0x0000000004a01d9b C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00925083 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00836007
[ 8] 0x0000000004a01939 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923961 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834885
[ 9] 0x0000000004a01884 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923780 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834704
[ 10] 0x00000000046c46de C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
[ 11] 0x00000000046c44fa C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017658 Mfh_file::dispatch_fh_with_reuse+00000062
[ 12] 0x00000000049f5166 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00872806 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00783730
[ 13] 0x00000000049740b7 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00344247 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00255171
[ 14] 0x000000000497430a C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00344842 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00255766
[ 15] 0x00000000049c38ea C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00669930 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00580854
[ 16] 0x0000000004b31a56 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+02169430 boost::archive::detail::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >+00001726
[ 17] 0x0000000004b319e9 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+02169321 boost::archive::detail::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >+00001617
[ 18] 0x00000000049c2ca2 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00666786 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00577710
[ 19] 0x0000000003000123 C:\Program Files\MATLAB\R2016b\bin\win64\m_interpreter.dll+00196899 inCallFcnWithTrapInDesiredWSAndPublishEvents+00000071
[ 20] 0x00000000033fcf52 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00315218 iqm::BaseFEvalPlugin::inCallFcnWithTrap+00000066
[ 21] 0x00000000033fcb7f C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00314239 iqm::BaseFEvalPlugin::execute+00000335
[ 22] 0x00000000fd0cae39 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00306745 mcrRegisterExternalFunction+00035625
[ 23] 0x00000000033f42fa C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00279290 iqm::Iqm::setupIqmFcnPtrs+00071530
[ 24] 0x00000000033f41d3 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00278995 iqm::Iqm::setupIqmFcnPtrs+00071235
[ 25] 0x00000000033d9e5a C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00171610 iqm::Iqm::deliver+00003274
[ 26] 0x00000000033dad2f C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00175407 iqm::Iqm::deliver+00007071
[ 27] 0x0000000002cd8173 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01147251 services::system_events::PpeDispatchHook::dispatchOne+00019059
[ 28] 0x0000000002cdc3a3 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164195 sysq::addProcessPendingEventsUnitTestHook+00001923
[ 29] 0x0000000002cdc580 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164672 sysq::addProcessPendingEventsUnitTestHook+00002400
[ 30] 0x0000000002cdd685 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01169029 sysq::getCondition+00002917
[ 31] 0x0000000002cde4b2 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01172658 svWS_ProcessPendingEvents+00000162
[ 32] 0x00000000fd0b6b7d C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00224125 mcr::runtime::setInterpreterThreadToCurrent+00026413
[ 33] 0x00000000fd0b726a C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00225898 mcr::runtime::setInterpreterThreadToCurrent+00028186
[ 34] 0x00000000fd0ae385 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00189317 mcr_process_events+00010293
[ 35] 0x00007ff931568364 C:\windows\System32\KERNEL32.DLL+00033636 BaseThreadInitThunk+00000020
[ 36] 0x00007ff931aa70d1 C:\windows\SYSTEM32\ntdll.dll+00422097 RtlUserThreadStart+00000033
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.
end
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!