Octave Wiki | RecentChanges

OctaveLinkToWindowsDLLs

Linking Octave to Windows DLLs

  // FILE: d_vcc.cpp
  #include <windows.h>
  extern "C" {
    BOOL WINAPI DllMain( HINSTANCE, DWORD, LPVOID ) { return 1;}
  
    int __declspec(dllexport)
    msgbox_plus_one( const char * text ){
        return MessageBox( NULL, text, "TITLE",
              MB_ABORTRETRYIGNORE | MB_SETFOREGROUND) + 1;
    }
  }

  // FILE: d_gcc.cc
  #include <octave/oct.h>
  extern "C" {
  int msgbox_plus_one( const char * text );
  }
  DEFUN_DLD (d_gcc,args, , "usage d_gcc('string')" ) {
     octave_value_list retval;
     retval(0) = (double) msgbox_plus_one( args(0).string_value().c_str() );
     return retval;
  }


CategoryExternal