[scilab-Users] API_Scilab example

jasper van baten jasper at amsterchem.com
Tue Apr 10 20:20:06 CEST 2012


I checked a very simple approach in MSVC (VS 2010):

#include "stdafx.h"
#include <api_scilab.h>
#include <call_scilab.h>


int APIENTRY _tWinMain(HINSTANCE hInstance,
                      HINSTANCE hPrevInstance,
                      LPTSTR    lpCmdLine,
                      int       nCmdShow)
{
     if (!StartScilab(NULL,NULL,NULL))
      {MessageBox(0,L"failed to start Scilab",L"Error:",MB_ICONHAND);
       return 0;
      }
     DisableInteractiveMode();

     if (0!=SendScilabJob("a=10;")) MessageBox(0,L"Error sending 
job",L"Error:",MB_ICONHAND);

     TerminateScilab(NULL);
     return 0;
}

To compile that, modules\core\includes, modules\call_scilab\includes and 
modules\api_scilab\includes need to be in your include path, and you 
should link against call_scilab.lib and api_scilab.lib, which are in the 
bin folder. The bin folder needs to also be in the path when you call 
the exe, as this is where the corresponding dlls are located.

Hope that helps,

Best wishes,

Jasper.

On 4/10/2012 19:44, Mikhail Matusov wrote:
> Hello Jasper,
> I was wondering if you could help me with the call_scilab example? 
> Could you please describe how you got it working? What C compiler are 
> you using? In which environment?
> Thanks,
> /Mikhail
> *From:* jasper van baten <mailto:jasper at amsterchem.com>
> *Sent:* Tuesday, April 10, 2012 1:10 PM
> *To:* users at lists.scilab.org <mailto:users at lists.scilab.org>
> *Subject:* Re: [scilab-Users] API_Scilab example
> Hello Sylvestre,
>
> I see the call_scilab example, which works fine.
>
> I would like an example of scilab calling a function implemented in C++.
>
> I have read the documentation, but I am apparently missing the 
> example. Would you be so kind to post the URL of the example itself?
>
> Thank you again,
>
> Best wishes,
>
> Jasper.
>
> On 4/10/2012 18:07, Sylvestre Ledru wrote:
>> Hello,
>>
>> You will find all the information and example in the api_scilab
>> documentation.
>> cf:
>> http://help.scilab.org/docs/5.3.3/en_US/api_scilab.html
>>
>> Sylvestre
>>
>> Le mardi 10 avril 2012 à 14:58 +0200, jasper van baten a écrit :
>>> Hello Sylvestre,
>>>
>>> Can you outline how to call a C (or C++)  function from Scilab? (what
>>> intersci used to do...)
>>>
>>> That is, suppose I have a C++ function Plus2:
>>>
>>> double Plus2(double arg) {return arg+2.0;}
>>>
>>> How can I use that from the Scilab command line?
>>>
>>> Thanks,
>>>
>>> Jasper.
>>>
>>> On 4/10/2012 08:28, Sylvestre Ledru wrote:
>>>> Hello,
>>>> On 10/04/2012 00:53, Mikhail Matusov wrote:
>>>>> Hi all,
>>>>> Can someone please point me to a simple example of how to use the
>>>>> API_Scilab? I am looking for ability to call SciLab functions from
>>>>> C, not the other way around.
>>>>>
>>>> api_scilab should be used when you want to add new features into
>>>> Scilab based on C/C++ libraries.
>>>> The documentation is here:
>>>> http://help.scilab.org/docs/5.3.3/en_US/api_scilab.html
>>>>
>>>> If you want to use Scilab as a computing enigne with C/C++, it is
>>>> here:
>>>> http://help.scilab.org/docs/5.3.3/en_US/call_scilab.html
>>>> And from Java:
>>>> http://help.scilab.org/docs/5.3.3/en_US/javasci.html
>>>>
>>>> Sylvestre
>>>>
>>>>
>>>>
>>>>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.2126 / Virus Database: 2411/4926 - Release Date: 04/10/12
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120410/87916667/attachment.htm>


More information about the users mailing list