<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723</link>
    <title>MATLAB Central Newsreader - segmentation error</title>
    <description>Feed for thread: segmentation error</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 08 Jan 2008 13:01:02 -0500</pubDate>
      <title>segmentation error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723#408527</link>
      <author>shopana </author>
      <description>hi all..&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;im getting the following segmentation error when i try &lt;br&gt;
to call functions using calllib&lt;br&gt;
&lt;br&gt;
calllib('Sand_RC','rc_firmwareid_get',libpointer)&lt;br&gt;
&lt;br&gt;
Saving minidump to file C:\DOCUME~1\seswaran\LOCALS~1&lt;br&gt;
\Temp\matlab_crash_dump.144.0.dmp&lt;br&gt;
&lt;br&gt;
-----------------------------------------------------------&lt;br&gt;
-------------&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Segmentation violation detected at Tue Jan 08 &lt;br&gt;
18:08:33 2008&lt;br&gt;
-----------------------------------------------------------&lt;br&gt;
-------------&lt;br&gt;
&lt;br&gt;
Configuration:&lt;br&gt;
&amp;nbsp;&amp;nbsp;MATLAB Version:   7.5.0.342 (R2007b)&lt;br&gt;
&amp;nbsp;&amp;nbsp;MATLAB License:   361308&lt;br&gt;
&amp;nbsp;&amp;nbsp;Operating System: Microsoft Windows XP&lt;br&gt;
&amp;nbsp;&amp;nbsp;Window System:    Version 5.1 (Build 2600: Service Pack &lt;br&gt;
2)&lt;br&gt;
&amp;nbsp;&amp;nbsp;Processor ID:     x86 Family 15 Model 11 Stepping 2, &lt;br&gt;
AuthenticAMD&lt;br&gt;
&amp;nbsp;&amp;nbsp;Virtual Machine:  Java 1.6.0 with Sun Microsystems Inc. &lt;br&gt;
Java HotSpot(TM) Client VM mixed mode&lt;br&gt;
&amp;nbsp;&amp;nbsp;Default Charset:  windows-1252&lt;br&gt;
&lt;br&gt;
Register State:&lt;br&gt;
&amp;nbsp;&amp;nbsp;EAX = 00000000  EBX = 00000040&lt;br&gt;
&amp;nbsp;&amp;nbsp;ECX = 00000000  EDX = 00000093&lt;br&gt;
&amp;nbsp;&amp;nbsp;ESI = 000000c0  EDI = 00cee0ec&lt;br&gt;
&amp;nbsp;&amp;nbsp;EBP = 00cee124  ESP = 00cee0ac&lt;br&gt;
&amp;nbsp;&amp;nbsp;EIP = 12ce3512  FLG = 00010216&lt;br&gt;
&lt;br&gt;
Stack Trace:&lt;br&gt;
&amp;nbsp;&amp;nbsp;[0] libusb0.dll:0x12ce3512(0, 192, 147, 64)&lt;br&gt;
&amp;nbsp;&amp;nbsp;[1] Sand_RC.dll:0x12c82289(0, 192, 147, 64)&lt;br&gt;
&amp;nbsp;&amp;nbsp;[2] Sand_RC.dll:0x12c843c3(0, 0, 64, 128)&lt;br&gt;
&amp;nbsp;&amp;nbsp;[3] Sand_RC.dll:0x12c84b54(0, 0x1241127f, &lt;br&gt;
0x00cee300 &quot;&amp;lt;??&quot;, 0x6e724c72)&lt;br&gt;
&amp;nbsp;&amp;nbsp;[4] libmwcli.dll:void * __cdecl callfcn(void const &lt;br&gt;
*,void const *,int)(0x12c81163, 0x1262d398, 4, 0x12416e5c) &lt;br&gt;
+ 35 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[5] libmwcli.dll:??&lt;br&gt;
$MakeCall@J@@YAJP6APAXPBX0H@ZABVNativeCall@@PAX@Z&lt;br&gt;
(0x6e728b60, 0x12416e5c, 0x12c81163, 0xdb044b23) + 34 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[6] libmwcli.dll:public: void __thiscall CCallMI::CallFcn&lt;br&gt;
(class UDMethodSignature *,void * *)(0x12a5d3c0, &lt;br&gt;
0x00cee39c, 0x12416e40, 0x00cee39c) + 610 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[7] libmwcli.dll:public: virtual void __thiscall &lt;br&gt;
CCallMI::invokeMethod(class UDMethodSignature *,int *,void &lt;br&gt;
* *,int,void * *)(0x12a5d3c0, 0x00cee3c0, 0x00cee39c, 1) + &lt;br&gt;
277 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[8] libmwcli.dll:void __cdecl CallLibFunction(char &lt;br&gt;
*,char *,int,struct mxArray_tag * * const,int,struct &lt;br&gt;
mxArray_tag const * * const)(0x14d8b4b0 &quot;Sand_RC&quot;, &lt;br&gt;
0x12a59520 &quot;rc_firmwareid_get&quot;, 0, 0x00cee4c4) + 534 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[9] libmwcli.dll:_mfCallLib(0, 0x00cee4c4, 3, &lt;br&gt;
0x14d8b4b0 &quot;Sand_RC&quot;) + 151 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[10] m_dispatcher.dll:public: virtual void __thiscall &lt;br&gt;
Mfh_builtin::dispatch_mf(int,struct mxArray_tag * &lt;br&gt;
*,int,struct mxArray_tag * *)(0, 0x00cee4c4, 3, &lt;br&gt;
0x00cee524) + 112 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[11] m_dispatcher.dll:public: virtual void __thiscall &lt;br&gt;
Mfh_MATLAB_fn::dispatch_fh(int,struct mxArray_tag * &lt;br&gt;
*,int,struct mxArray_tag * *)(0, 0x00cee4c4, 3, &lt;br&gt;
0x00cee524) + 163 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[12] m_interpreter.dll:__catch$?&lt;br&gt;
inDispatchFromStack@@YAHHPBDHH@Z$0(150, &lt;br&gt;
0x5d03d320 &quot;calllib&quot;, 0, 3) + 744 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[13] m_interpreter.dll:enum opcodes __cdecl &lt;br&gt;
inDispatchCall(char const *,int,int,int,int *,int *)&lt;br&gt;
(0x5d03d320 &quot;calllib&quot;, 150, 0, 3) + 156 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[14] m_interpreter.dll:int __cdecl inInterp(enum &lt;br&gt;
inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag &lt;br&gt;
volatile *,int *)(2, 0, 0, 0) + 2739 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[15] m_interpreter.dll:int __cdecl protected_inInterp&lt;br&gt;
(enum inDebugCheck,int,int,enum opcodes,struct &lt;br&gt;
inPcodeNest_tag *,int *)(2, 0, 0, 0) + 87 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[16] m_interpreter.dll:int __cdecl inInterPcodeSJ(enum &lt;br&gt;
inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag &lt;br&gt;
*,int *)(2, 0, 0, 0) + 274 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[17] m_interpreter.dll:_inInterPcode(2, 0x9ba70b24, 0, &lt;br&gt;
0x127c8820 &quot;calllib('Sand_RC','rc_firmwa..&quot;) + 162 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[18] m_interpreter.dll:enum inExecutionStatus __cdecl &lt;br&gt;
in_local_call_eval_function(int *,struct _pcodeheader &lt;br&gt;
*,int *,struct mxArray_tag * * const,enum &lt;br&gt;
inDebugCheck,bool)(0x00cef2bc, 0x00cef32c, 0x00cef358, 2) &lt;br&gt;
+ 152 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[19] m_interpreter.dll:enum inExecutionStatus __cdecl &lt;br&gt;
inEvalStringWithIsVarFcn(struct _memory_context *,char &lt;br&gt;
const *,enum EvalType,int,struct mxArray_tag * * &lt;br&gt;
const,enum inDebugCheck,struct _pcodeheader *,int *,bool &lt;br&gt;
(__cdecl*)(void *,char const *),void *,bool)(0x7ac2177c, &lt;br&gt;
0x127c8820 &quot;calllib('Sand_RC','rc_firmwa..&quot;, 0, 0) + 2454 &lt;br&gt;
bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[20] m_interpreter.dll:enum inExecutionStatus __cdecl &lt;br&gt;
inEvalCmdWithLocalReturnandtype(char const *,int *,enum &lt;br&gt;
inDebugCheck,bool)(0x127c8820 &quot;calllib&lt;br&gt;
('Sand_RC','rc_firmwa..&quot;, 0, 2, 0) + 107 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[21] m_interpreter.dll:_inEvalCmdNoEnd&lt;br&gt;
(0x127c8820 &quot;calllib('Sand_RC','rc_firmwa..&quot;, 0, &lt;br&gt;
0x9b5cd7a6, 0x7ab9e7f0) + 20 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[22] bridge.dll:enum inExecutionStatus __cdecl &lt;br&gt;
ThrowSignal(char const *)(0x127c8820 &quot;calllib&lt;br&gt;
('Sand_RC','rc_firmwa..&quot;, 0x9b5cd0ea, 0x014c4010, &lt;br&gt;
0x014c3fb0) + 77 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[23] bridge.dll:__catch$_mnParser$0(0x9b597135, &lt;br&gt;
0x014c3fb0, 0x014c3fb0, 0) + 292 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[24] mcr.dll:public: void __thiscall &lt;br&gt;
mcrInstance::mnParser(void)(0x9b597838, 0x004043f0, &lt;br&gt;
336710, 0) + 62 bytes&lt;br&gt;
&amp;nbsp;&amp;nbsp;[25] MATLAB.exe:0x00401414(4194304, 0, 336710, 10)&lt;br&gt;
&amp;nbsp;&amp;nbsp;[26] MATLAB.exe:0x00401733(0, 0, 0x7ffdf000, 0x8054a6ed)&lt;br&gt;
&amp;nbsp;&amp;nbsp;[27] kernel32.dll:0x7c816fd7(0x00401910, 0, 0x78746341, &lt;br&gt;
32)&lt;br&gt;
&lt;br&gt;
Please follow these steps to report this problem to The &lt;br&gt;
MathWorks so we&lt;br&gt;
have the best chance of correcting it:&lt;br&gt;
&lt;br&gt;
The next time MATLAB is launched under typical usage, a &lt;br&gt;
dialog box will&lt;br&gt;
open to help you send the error log to The MathWorks. &lt;br&gt;
Alternatively, you&lt;br&gt;
can send an e-mail to segv@mathworks.com with the &lt;br&gt;
following file attached:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;C:\DOCUME~1\sesw\LOCALS~1\Temp\matlab_crash_dump.144&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;can anyone help me?thanks</description>
    </item>
    <item>
      <pubDate>Tue, 08 Jan 2008 19:18:01 -0500</pubDate>
      <title>Re: segmentation error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723#408607</link>
      <author>Malcolm Lidierth</author>
      <description>You seem to be passing an empty pointer to your dll hence &lt;br&gt;
the memory violation.&lt;br&gt;
&lt;br&gt;
It is generally simplest to pass MATLAB variables in callib.&lt;br&gt;
If these are non-scalar they will need to be pre-allocated &lt;br&gt;
to prevent memory overruns (the dll receives a pointer and &lt;br&gt;
has no idea of matlab matrix size)&lt;br&gt;
&lt;br&gt;
e.g.&lt;br&gt;
&lt;br&gt;
string=char(zeros(1,80));&lt;br&gt;
string=calllib('dll', 'procname', fh, n, string, 79);&lt;br&gt;
&lt;br&gt;
Watch out for the terminating null when using strings.</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 04:31:02 -0500</pubDate>
      <title>Re: segmentation error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723#408648</link>
      <author>shopana </author>
      <description>&quot;Malcolm Lidierth&quot; &amp;lt;ku.ca.lck@htreidil.mloclam&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fm0i99$60m$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; You seem to be passing an empty pointer to your dll &lt;br&gt;
hence &lt;br&gt;
&amp;gt; the memory violation.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; It is generally simplest to pass MATLAB variables in &lt;br&gt;
callib.&lt;br&gt;
&amp;gt; If these are non-scalar they will need to be pre-&lt;br&gt;
allocated &lt;br&gt;
&amp;gt; to prevent memory overruns (the dll receives a pointer &lt;br&gt;
and &lt;br&gt;
&amp;gt; has no idea of matlab matrix size)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; e.g.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; string=char(zeros(1,80));&lt;br&gt;
&amp;gt; string=calllib('dll', 'procname', fh, n, string, 79);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Watch out for the terminating null when using strings.&lt;br&gt;
&lt;br&gt;
thanks for your help,but my return value i.e, libpointer &lt;br&gt;
is scalar ,also that value is coming from the another &lt;br&gt;
calllib function.Here is my code.&lt;br&gt;
&lt;br&gt;
A1=calllib('Sand_RC','rc_open',6,70)&lt;br&gt;
A1 =&lt;br&gt;
&amp;nbsp;&lt;br&gt;
libpointer&lt;br&gt;
&lt;br&gt;
calllib('Sand_RC','rc_deviceid_get,A1)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
i dont know want i did wrong here.can you help me?&lt;br&gt;
&amp;nbsp;</description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 08:13:03 -0500</pubDate>
      <title>Re: segmentation error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723#408670</link>
      <author>shopana </author>
      <description>&quot;shopana &quot; &amp;lt;shopana.e@hcl.in&amp;gt; wrote in message &amp;lt;fm1im6&lt;br&gt;
$8ck$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Malcolm Lidierth&quot; &amp;lt;ku.ca.lck@htreidil.mloclam&amp;gt; wrote in &lt;br&gt;
&amp;gt; message &amp;lt;fm0i99$60m$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; You seem to be passing an empty pointer to your dll &lt;br&gt;
&amp;gt; hence &lt;br&gt;
&amp;gt; &amp;gt; the memory violation.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; It is generally simplest to pass MATLAB variables in &lt;br&gt;
&amp;gt; callib.&lt;br&gt;
&amp;gt; &amp;gt; If these are non-scalar they will need to be pre-&lt;br&gt;
&amp;gt; allocated &lt;br&gt;
&amp;gt; &amp;gt; to prevent memory overruns (the dll receives a pointer &lt;br&gt;
&amp;gt; and &lt;br&gt;
&amp;gt; &amp;gt; has no idea of matlab matrix size)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; e.g.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; string=char(zeros(1,80));&lt;br&gt;
&amp;gt; &amp;gt; string=calllib('dll', 'procname', fh, n, string, 79);&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Watch out for the terminating null when using strings.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thanks for your help,but my return value i.e, libpointer &lt;br&gt;
&amp;gt; is scalar ,also that value is coming from the another &lt;br&gt;
&amp;gt; calllib function.Here is my code.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; A1=calllib('Sand_RC','rc_open',6,70)&lt;br&gt;
&amp;gt; A1 =&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; libpointer&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; calllib('Sand_RC','rc_deviceid_get,A1)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i dont know want i did wrong here.can you help me?&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Wed, 09 Jan 2008 13:16:02 -0500</pubDate>
      <title>Re: segmentation error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723#408698</link>
      <author>Malcolm Lidierth</author>
      <description>The pointer A1 presumbaly then points to memory outside the &lt;br&gt;
MATLAB workspace as it is allocated by the first calllib.&lt;br&gt;
&lt;br&gt;
What do you see with get(A1) and libfunctions for these dll &lt;br&gt;
routines?</description>
    </item>
    <item>
      <pubDate>Thu, 10 Jan 2008 06:09:01 -0500</pubDate>
      <title>Re: segmentation error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723#408828</link>
      <author>shopana </author>
      <description>&quot;Malcolm Lidierth&quot; &amp;lt;ku.ca.lck@htreidil.mloclam&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fm2hei$3i8$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; The pointer A1 presumbaly then points to memory outside &lt;br&gt;
the &lt;br&gt;
&amp;gt; MATLAB workspace as it is allocated by the first calllib.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What do you see with get(A1) and libfunctions for these &lt;br&gt;
dll &lt;br&gt;
&amp;gt; routines?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
get(a1),returns the error message:&lt;br&gt;
??? Error using ==&amp;gt; get&lt;br&gt;
Invalid handle object.&lt;br&gt;
&lt;br&gt;
libfunction list the available functions in DLL. how to &lt;br&gt;
rectify this(The pointer A1 presumbaly then points to &lt;br&gt;
memory outside the MATLAB workspace as it is allocated by &lt;br&gt;
the first calllib).thank you</description>
    </item>
    <item>
      <pubDate>Thu, 10 Jan 2008 10:50:19 -0500</pubDate>
      <title>Re: segmentation error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161723#408851</link>
      <author>Malcolm Lidierth</author>
      <description>So it looks as though A1 is not a libpointer.&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; A1=3&lt;br&gt;
&lt;br&gt;
A1 =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; get(A1)&lt;br&gt;
??? Error using ==&amp;gt; get&lt;br&gt;
Invalid handle object.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; A1=libpointer('double',1)&lt;br&gt;
&amp;nbsp;&lt;br&gt;
A1 =&lt;br&gt;
&amp;nbsp;&lt;br&gt;
libpointer&lt;br&gt;
&amp;gt;&amp;gt; get(A1)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Value: 1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DataType: 'double'&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; class(A1)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
lib.pointer</description>
    </item>
  </channel>
</rss>

