help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: call c++ dlls in octave


From: Tatsuro MATSUOKA
Subject: Re: call c++ dlls in octave
Date: Fri, 19 Dec 2008 08:35:04 +0900 (JST)

--- address@hidden wrote:

> Date:Thu, 18 Dec 2008 21:54:30 +0900 (JST)
> From:address@hidden
> Subject:Re: call c++ dlls in octave
> To:address@hidden
> 
> Oh you are using theoctave-mingw!  My instruction is for octave-msvc.  
> 
> Your problem is more general so that I cannot answer at the moment. 
> 
> --------------------------------------
> Power up the Internet with Yahoo! Toolbar.
> http://pr.mail.yahoo.co.jp/toolbar/
> 
--- Allahyari Rahim <address@hidden> wrote:

> Hi,
> &#65533;
> I have to call a lot of function from a folder for example TWUClib
> In this folder are my head and source files. Is it possible to call all this 
> directly from
> octave or I have to copy all into octave listing? 
> &#65533;&#65533;
> What can I do with \x9C#include <octave/oct.h>\x9D 
> and function&#65533; DEFUN_DLD (oregonator, args, ,&#65533; "The 
> `oregonator'.")
> do I need to include all my function with #include <octave/oct.h>
> or can I build a file for example myfile.cc and and call all function from 
> this file&#65533;//
> myfile.cc#include&#65533; <octave/oct.h> #include <TWUClib.h>DEFUN_DLD 
> (oregonator, args, ,&#65533;
"The
> `oregonator'."){&#65533;&#65533;&#65533; 皃.&#65533;&#65533;&#65533; 
> TWUopenSignal2(char const * a,
char const * b, char const * c,
> int d );&#65533;&#65533;&#65533;
皃.&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
 }
> &#65533;I apropos &#65533;tested &#65533;&#65533;oregonator file. &#65533;it 
> is running. Without any
problem.
> &#65533;
> &#65533;
>
&#65533;[.]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
hello.oct&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
[MSYS]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
 [share]
>
[..]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
[include]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
octave-core&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; testOrego2.m
>
[bin]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
[lib]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
oregonator.cc&#65533;&#65533;&#65533;&#65533; [tools]
>
[doc]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
[libexec]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
oregonator.o&#65533;&#65533;&#65533;&#65533;&#65533; uninstaller.exe
> hello.cc&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
[license]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; 
oregonator.oct
> hello.o&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
[mingw32]&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; 
README.txt
>
&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
10 Datei(en)&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; 206.844 
Bytes
>
&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
12 Verzeichnis(se), 23.336.656.896 Bytes frei
> octave-3.0.2.exe:3:C:\Programme\Octave\3.0.2_gcc-4.3.0
> > testOrego2
> ans =&#65533; 0.15625
> octave-3.0.2.exe:4:C:\Programme\Octave\3.0.2_gcc-4.3.0
> >
> &#65533;thanks 
> --- Tatsuro MATSUOKA <address@hidden> schrieb am Do, 18.12.2008:
> 
> Von: Tatsuro MATSUOKA <address@hidden>
> Betreff: Re: call c++ dlls in octave
> An: "Michael Goffioul" <address@hidden>, address@hidden
> CC: address@hidden
> Datum: Donnerstag, 18. Dezember 2008, 1:58
> 
> Hello
> 
> The url is described at 
> the Note of 1.1. Octave-Forge: GNU Octave Repository
> in
> http://wiki.octave.org/wiki.pl?OctaveForWindows
> 
> You can see it from
> http://www.tatsuromatsuoka.com/octave/Eng/Win/index.html#0004
> msvcoct.html,4,602 bytes, 2008-11-25, md5 c76eaead3a6c2fe151403875459d31c4,
> Note for mkoctfile (and
> pkg install) for MSVC-octave 3.0.3.
> 
> Regards
> 
> Tatsuro
>  
> --- Michael Goffioul <address@hidden> wrote:
> > Tatsuro has made a nice page will all information needed
> > to compile oct-file under Windows (Tatsuro, can you post
> > the link?).
> 
> 
> 
> --------------------------------------
> Power up the Internet with Yahoo! Toolbar.
> http://pr.mail.yahoo.co.jp/toolbar/
> 
> 
> 
>       > /* 
> ------------------------------------------------------------------------ */
> /* 
>  * This header declares the public, standard-C interfaces of 
>  * the TWUClib, the "TEC Web-Umbrella Client" library
>  *
>  * Author: Jon Krom, Forschungszentrum Juelich, Institut fuer Plasmaphysik.
>  * $Id: TWUClib-base.h,v 2.15 2008/11/14 13:20:46 jgk Exp $
>  * Copyright (c) 2000,...,2008  Forschungszentrum Juelich GmbH.
>  * All rights reserved.
>  */
> /* ------------------------------------------------------------------------ */
> 
> #ifndef TWUCLIBBASE_H
> #define TWUCLIBBASE_H
> 
> #ifdef  __cplusplus
> extern "C" 
> {
> #endif
> 
>     /* -------------------------------------------------------------------- */
>     /* Local types and forward declarations */
> 
>     struct TWUlinkContext;              /* Open link context */
> 
>     typedef struct TWUlinkContext * TWUContext;
> 
>     enum TWUClib_Open_Options           /* A bit map of options */
>     {
>         TWOO_no_options     = 0,
>         TWOO_propertiesOnly = 0x1,      /* Pre-fetch at most the properties */
>         TWOO_keepHTTPhead   = 0x2,      /* Keep the HTTP header visible     */
>         TWOO_allowbinary    = 0x4,      /* Allow binary IEEE float transfers*/
>         TWOO_dont_fake      = 0x8,      /* Do not fake equidistant signals  */
>         TWOO_default        = TWOO_allowbinary
>     };
> 
>     /* -------------------------------------------------------------------- */
>     struct TWUlinkContext *
>     TWUopenURL(
>         char const *        ,           /* URL */
>         enum TWUClib_Open_Options );    /* Open options */
> 
>     /* -------------------------------------------------------------------- */
> 
>     struct TWUlinkContext *             /* Context pointer */
>     TWUopenSignal2(
>         char const *,                   /* URL */
>         char const *,                   /* bulk query string */
>         char const *,                   /* properties query string */
>         int );                          /* enum TWUClib_Open_Options  */
> 
>     /* -------------------------------------------------------------------- */
>     int
>     TWUhasError(
>         struct TWUlinkContext const *); /* Context pointer */
> 
>     /* -------------------------------------------------------------------- */
>     char const *
>     TWUerrorInfo(
>         struct TWUlinkContext const *,  /* Context pointer  */
>         int                         *,  /* Last HTTP status */
>         char const *                *,  /* TWUerror text (static const)  */
>         char const *                *); /* errno - text from strerror(3) */
> 
>     /* -------------------------------------------------------------------- */
>     char const *                        /* ptr to property value */
>     TWUgetproperty(
>         struct TWUlinkContext *,        /* Context pointer */
>         char            const *);       /* Required property keyword */
> 
>     /* -------------------------------------------------------------------- */
>     char *
>     TWUgetline(
>         struct TWUlinkContext *);       /* Context pointer */
> 
>     /* -------------------------------------------------------------------- */
>     int
>     TWUgetsingles(
>         struct TWUlinkContext *,        /* Context pointer */
>         float *                ,        /* floatArray      */
>         int                    );       /* floatArraySize  */
> 
>     /* -------------------------------------------------------------------- */
>     int
>     TWUgetdoubles(
>         struct TWUlinkContext *,        /* Context pointer */
>         double *               ,        /* floatArray      */
>         int                    );       /* floatArraySize  */
> 
>     /* -------------------------------------------------------------------- */
>     void
>     TWUreleaseLink(
>         struct TWUlinkContext **);      /* Context pointer */
> 
>     /* -------------------------------------------------------------------- */
>     char const *
>     TWUsetUserAgent(
>         char const * );                 /* A new "user agent" program name */
> 
>     /* -------------------------------------------------------------------- */
> #ifdef  __cplusplus
> }
> #endif
> 
> #endif /* TWUCLIBBASE_H */
> /* End of: $Id: TWUClib-base.h,v 2.15 2008/11/14 13:20:46 jgk Exp $ */
> /* ------------------------------------------------------------------------ */
> > /* ------------------------------------------------------------------------ 
> > */
> /* 
>  * This file defines the high-level TWU-client operations for 
>  * opening a TWU-signal URL.
>  * 
>  * Author: Jon Krom, Forschungszentrum Juelich, Institut fuer Plasmaphysik.
>  * $Id: TWUopenSignal.c,v 2.12 2008/11/14 13:20:45 jgk Exp $
>  * Copyright (c) 2000 Forschungszentrum Juelich GmbH.
>  * All rights reserved.
>  *
>  * For change history use the cvs log command.
>  */
> /* ------------------------------------------------------------------------ */
> 
> #include <string.h>
> 
> #include "TWUClib.h"
> #include "TWUClibInternal.h"
> #include "TWUlinkContext.h"
> 
> #ifdef WIN32
> #   define  LOCALCONST              /* Keep silly Microsoft compiler quiet */
> #else
> #   define  LOCALCONST const        /* Standard-C compilers understand this */
> #endif
> 
> 
> /* ------------------------------------------------------------------------ */
> struct TWUlinkContext *
> TWUopenSignal2( char const *              LOCALCONST URL, 
>                 char const *              LOCALCONST bulk_query,
>                 char const *              LOCALCONST prop_query,
>                 int                       LOCALCONST options)
> {
>     struct TWUlinkContext * context ;
> 
>     if (options & TWOO_propertiesOnly )
>     {
>         context = TWUopenURLQ( URL, prop_query, options );
>     }
>     else
>     {
>         context = TWUopenURLQ( URL, prop_query ? prop_query : "terse", 
> options );
>     
>         TWUcloseLink(context);
> 
>         if ( ! TWUhasError(context) &&  
>              ! fakingPrepared(context, URL, bulk_query, options ) )
>         {
>             char const * bulkname = TWUgetproperty( context, "Bulkfile.URL" );
> 
>             if(bulkname)
>             {
>                 struct TWUlinkContext * bulkfile ;
> 
>                 bulkfile = TWUopenURLQ( bulkname, bulk_query, options);
>                 bulkfile->associate = context;
> 
>                 if (TWUhasError(bulkfile) )
>                   TWUcloseLink(bulkfile);
> 
>                 context = bulkfile;
>             }
>         }
>     }
>     if ( !(options & TWOO_keepHTTPhead ) && !TWUhasError(context) )
>       TWUjumpHead(context);
> 
>     return context;
> }
> 
> /* ------------------------------------------------------------------------ */
> /* Deprecated function - Not to be used anymore
>  * Only provided here to satisfy linking against user codes 
>  * that still depend on it.
>  */
> struct TWUlinkContext * TWUopenSignal(char const * , char const * , int );
> 
> struct TWUlinkContext *
> TWUopenSignal( char const * LOCALCONST URL, 
>                char const * LOCALCONST query_str,
>                int          LOCALCONST options)
> {
>     return TWUopenSignal2( URL, query_str, query_str, 
>                            (enum TWUClib_Open_Options)options);
> }
> 
> 
> /* ------------------------------------------------------------------------ */
> /* End of: $Id: TWUopenSignal.c,v 2.12 2008/11/14 13:20:45 jgk Exp $ */
> /* ------------------------------------------------------------------------ */
> 


--- Michael Goffioul <address@hidden> wrote:

> Octave does not support loadlibrary and related.
> To call functions from a DLL, you need to wrap the function
> into an oct-file. This is rather easy to do and there exist
> some examples in octave source tree (this has been
> mentioned before on this mailing list, you might want
> to search through previous posts).
> 
> To build an oct-file, you obviously need a compiler.
> As you're probably using the precompiled version
> from octave-forge, you'll need the Visual C++ 2008
> compiler (available free of charge from MS web site).
> Tatsuro has made a nice page will all information needed
> to compile oct-file under Windows (Tatsuro, can you post
> the link?).
> 
> Michael.
> 
> 
> On Wed, Dec 17, 2008 at 7:45 AM, Allahyari Rahim <address@hidden> wrote:
> > Hi,
> > i want to call my dll with octave 3.0.3
> > but i don't know how can i solve this problem.
> > i have used dll in Matlab like this
> >
> > " myPath = 'C:\TWUClib\Win32\lib';
> >   hfile =  'C:\TWUClib\Win32\include\TWUClib-base.h';
> >   loadlibrary([myPath '\TWUClib'],hfile);
> >   signal=calllib('TWUClib','TWUopenSignal2',url,'','',TWOO_default);
> > "
> > i tried to use mkoctfile to build oct file.and ... but can't continue.
> > can anybody help me.
> > thanks
> > Allahyari
> >
> > _______________________________________________
> > Help-octave mailing list
> > address@hidden
> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >
> >
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> 


--------------------------------------
Power up the Internet with Yahoo! Toolbar.
http://pr.mail.yahoo.co.jp/toolbar/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]