Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: segmentation error
Date: Tue, 8 Jan 2008 19:18:01 +0000 (UTC)
Organization: King's College London
Lines: 14
Message-ID: <fm0i99$60m$1@fred.mathworks.com>
References: <flvs6e$1tb$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1199819881 6166 172.30.248.38 (8 Jan 2008 19:18:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 8 Jan 2008 19:18:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1477
Xref: news.mathworks.com comp.soft-sys.matlab:444935



You seem to be passing an empty pointer to your dll hence 
the memory violation.

It is generally simplest to pass MATLAB variables in callib.
If these are non-scalar they will need to be pre-allocated 
to prevent memory overruns (the dll receives a pointer and 
has no idea of matlab matrix size)

e.g.

string=char(zeros(1,80));
string=calllib('dll', 'procname', fh, n, string, 79);

Watch out for the terminating null when using strings.