Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!nx01.iad01.newshosting.com!newshosting.com!198.186.194.251.MISMATCH!news-out.readnews.com!transit4.readnews.com!newspeer1.nwr.nac.net!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny04.POSTED!702e7bde!not-for-mail
From: James Tursa <aclassyguywithaknotac@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: starting engopen
Message-ID: <cjdek3lmoblqs33mibkf45l9bud8sil65v@4ax.com>
References: <fi705k$gau$1@fred.mathworks.com> <fi72d7$a5o$1@fred.mathworks.com>
X-Newsreader: Forte Agent 3.3/32.846
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 66
Date: Fri, 23 Nov 2007 20:31:54 GMT
NNTP-Posting-Host: 71.112.90.26
X-Complaints-To: abuse@verizon.net
X-Trace: trndny04 1195849914 71.112.90.26 (Fri, 23 Nov 2007 15:31:54 EST)
NNTP-Posting-Date: Fri, 23 Nov 2007 15:31:54 EST
Bytes: 2543
Xref: news.mathworks.com comp.soft-sys.matlab:439096


On Fri, 23 Nov 2007 17:24:56 +0000 (UTC), "Thomas "
<thomas.schmelzer.nospam@gmail.com> wrote:

>Ok, I have done some further research and here's what's 
>going on:
>
>
>I see that Matlab boots up 
>when engOpen("\0") is executed, but then Matlab immediately 
>quits
>before execution passes to the next line. I have tried 
>calling both
>"matlab /regserver" and "matlab /Automation" from the 
>Windows command
>line; both call up Matlab, but then Matlab still quits when 
>engOpen
>is called.
>
>I have no leads to determine the cause of the problem.
>
>Any suggestions?
>
>Thank you,
>Thomas
>
>compare with
>http://www.code-hosting.com/Matlab/1552688-engOpen---
>returns-NULL-after-upgrade-to-R14-SP3-on-XP

Here is the MATLAB doc on this:

    External Interfaces Reference    
    engOpen (C)

    Start MATLAB engine session
    C Syntax

    #include "engine.h"
    Engine *engOpen(const char *startcmd);

    Arguments

    startcmd
    
    String to start MATLAB process. On Windows, the startcmd string
must be NULL.


So here is what I use to open the engine on Windows XP:

ep = engOpen( NULL );

i.e., I am passing the NULL pointer to engOpen. You are not passing
the NULL pointer to engOpen, you are passing a valid string, namely

"\0"

This is a string with a valid memory address containing two
characters, the null character and another null character terminator.
Not the same thing as I am doing or what MATLAB doc says.

And remember the engine opens pointed to the default startup directory
for MATLAB, which may not be the same directory as your c program. If
you need help fixing that part let me know.

James Tursa