Interfacing octave with C#

后端 未结 5 2015
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 18:09

I have developed a program in Octave to which I would like to add a GUI layer. I want to create an executable program in C# that I can distribute but want to stick with the

5条回答
  •  [愿得一人]
    2020-12-15 18:44

    To build a standalone: http://www.gnu.org/software/octave/doc/interpreter/Standalone-Programs.html#Standalone-Programs

    I have a similar problem, which is to create a .dll for C# I've been looking for a way to do this for a while now, I have not been able to find instructions or an easy way to do it. This is more an ongoing project than a question, but I' d definitely take any answer or help!:)

    I am planning to keep track of my efforts here, so at the end this should become a page that will allow people to find how to compile octave into a .dll ( always assuming this is possible)

    So:

    -I am using VS2010

    -I started with the MS VS2010 compiled binaries for octave, assuming this will be closer.

    -I created a project in VS and used the following code:

    #include 
    #include 
    #include 
    #include 
    
    
    int main(int argc, char* argv[])
    {
        std::cout<<"hello world"<>a;
        return 0;
    }
    

    -The code would of course not find the octave libs, so I added them, e.g.,

    C:\Octave\Octave-3.6.1-VS10\lib\octave\3.6.1;C:\Octave\Octave-3.6.1-VS10\include\octave-3.6.1;C:\Octave\Octave-3.6.1-VS10\include;$(VCInstallDir)include;...
    

    To Include Directories (Right click on Project-->Properties)

    Now I get

    Error   73  error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall octave_value::~octave_value(void)" (__imp_??1octave_value@@QAE@XZ) referenced in function "public: void * __thiscall octave_value::`vector deleting destructor'(unsigned int)" (??_Eoctave_value@@QAEPAXI@Z)    ...\Projects\cppap32\cppap32\main.obj   cppap32
    

    which basically means it cannot find octave_value... By using dumpbin.exe we can see that it needs to have both octave.lib AND octinterp.lib

    It now does compile.... :)

    Next step create a .dll ...

    Notes:

    To check what is exported by a .lib:

    dumpbin.exe /exports C:\Octave\Octave-3.6.1-VS10\lib\octave\3.6.1\octave.lib
    

    Relevant links:

    Similar, open question on other site: http://www.daniweb.com/software-development/cpp/threads/297336/gnu-octave-for-c-how-to-start

提交回复
热议问题