7019
|
1 c Copyright (C) 2006, 2007 John W. Eaton |
|
2 c |
|
3 c This file is part of Octave. |
|
4 c |
|
5 c Octave is free software; you can redistribute it and/or modify it |
|
6 c under the terms of the GNU General Public License as published by the |
|
7 c Free Software Foundation; either version 3 of the License, or (at your |
|
8 c option) any later version. |
|
9 c |
|
10 c Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 c for more details. |
|
14 c |
|
15 c You should have received a copy of the GNU General Public License |
|
16 c along with Octave; see the file COPYING. If not, see |
|
17 c <http://www.gnu.org/licenses/>. |
|
18 |
5864
|
19 subroutine mexFunction (nlhs, plhs, nrhs, prhs) |
|
20 |
|
21 implicit none |
|
22 |
|
23 integer*4 nlhs, nrhs |
|
24 |
|
25 * The following will need to be integer*8 on 64-bit systems, otherwise |
|
26 * these variables won't be large enough to hold pointers... |
|
27 integer*4 plhs(*), prhs(*) |
|
28 |
|
29 integer*4 mxIsString, mxGetString, mxGetN, mexCallMATLAB |
|
30 integer*4 status, len |
|
31 character*100 str |
|
32 |
|
33 call mexPrintf ('Hello, World!') |
|
34 |
|
35 if (nrhs .lt. 1 .or. mxIsString (prhs(1)) .ne. 1) then |
|
36 call mexErrMsgTxt ('function name expected') |
|
37 endif |
|
38 |
|
39 len = mxGetN (prhs(1)) |
|
40 |
|
41 status = mxGetString (prhs(1), str, 100) |
|
42 |
|
43 call mexPrintf ('FORTRAN will call the interpreter now') |
|
44 |
|
45 status = mexCallMATLAB (nlhs, plhs, nrhs-1, prhs(2), str(1:len)) |
|
46 |
|
47 return |
|
48 end |