Professional Web Applications Themes

Embedded Ruby in a MSVC++ project? - Ruby

Hey all, I'm working on a project in MS Visual C++, unfortunately the code is completely tied to that environment and that IDE so I'm trapped. That C++ code has a GUI which loads a bunch of data, then runs a given algorithm on each record, deciding whether it passes a test or not. The algorithm has more than 100 variables with certain interdependencies, and what I'm working on now is a way of trying to tune the variables to get the best result. This parameter tuning sounds much easier in Ruby than it does in C, so I'd like ...

  1. #1

    Default Embedded Ruby in a MSVC++ project?

    Hey all,

    I'm working on a project in MS Visual C++, unfortunately the code is
    completely tied to that environment and that IDE so I'm trapped. That C++
    code has a GUI which loads a bunch of data, then runs a given algorithm on
    each record, deciding whether it passes a test or not. The algorithm has
    more than 100 variables with certain interdependencies, and what I'm
    working on now is a way of trying to tune the variables to get the best
    result. This parameter tuning sounds much easier in Ruby than it does in
    C, so I'd like to use a Ruby extension to do it.

    Now last night I struggled through the doentation, examples, and
    messages and managed to build a C program that uses a Ruby extension on my
    iBook in OS X. It wasn't easy, but once I figured out what I was doing it
    worked fine. But since Windows (and MSVC++) is so different from OS X and
    other Unixish OSes I don't know how to start with embedding Ruby in this
    environment.

    Could someone give me a hand doing the same thing in MSVC++, provided it is
    possible?

    Ben


    Ben Giddings Guest

  2. #2

    Default Re: Embedded Ruby in a MSVC++ project?

    | I'm working on a project in MS Visual C++, unfortunately the code is
    | completely tied to that environment and that IDE so I'm trapped.

    Visual Studio has an SDK to interface to the IDE, for doing tool
    plugins, etc. Recently, the VS team added a new free level to this VSIP
    program. Previously, the VSIP SDK was only available for a fee. This
    would only be interesting if the answer to this embedding Ruby question
    involves tweaking VS.
    [url]http://msdn.microsoft.com/vstudio/partners/[/url]
    [url]http://www.vsipdev.com/[/url]
    [url]http://www.vsippartners.com/programoverview.aspx[/url]

    Also, you can extend VS w/o having to use VSIP in a few ways.
    [url]http://msdn.microsoft.com/vstudio/using/understand/tools/default.aspx[/url]

    The microsoft.public.vsnet.general newsgroup is the place to discuss
    topics like this. My apologies that some of the people on that forum
    might not know much about Ruby. :-)
    [url]http://msdn.microsoft.com/vstudio/support/community/default.aspx[/url]

    Hope this is helps,
    Lee

    Lee Fisher Guest

  3. #3

    Default Re: Embedded Ruby in a MSVC++ project?

    Lee Fisher wrote:
    > Visual Studio has an SDK to interface to the IDE, for doing tool
    > plugins, etc.
    I think you misunderstand, I don't want to modify the IDE at all, I want to
    embed Ruby in my program which is compiled using the IDE. What I meant
    when I said that it was tied to that environment was that it uses a lot of
    Microsoftisms in the code and other things that make it unportable code.

    So, I'm stuck using Visual C++ for this project, but I still want to embed
    Ruby in the executable.

    Looking around the directories, so far I found two .lib files that appear
    to be what are needed to do this. I used the non-static one (the static
    one caused errors about multiply defined functions), and once I moved the
    .dll I found in the ruby/bin directory into the project directory things
    compiled.

    In fact, things seem to be working well, but I can't seem to load the Ruby
    file. I've tried with the file in the project directory, as well as in the
    Debug directory, but Ruby doesn't seem to find it. Any suggestions on how
    I can figure out Ruby's load-path? (Normally I'd do rb_p("$:") or
    something similar, but since this is a GUI project I don't know where
    stdout/stderr go).

    Thanks,

    Ben



    Ben Giddings Guest

  4. #4

    Default Re: Embedded Ruby in a MSVC++ project?

    Lee Fisher wrote:
    > Recently, the VS team added a new free level to this VSIP program.
    That's great news, thanks Lee.

    I have a much simpler VS question. In Tools->Options->Text Editor,
    there is a list of supported languages. You can set the indenting
    depths and tab usage for each language. Lots of folk here are editing
    Ruby using VS, but there doesn't appear to be a way to add Ruby as
    a recognised language - obviously not for debugging purposes but even
    for editing. Anyone have a clue how to fix this? It seems amazing to
    me that a sophisticated IDE like this doesn't have extensible editor
    settings...

    Clifford.

    Clifford Heath Guest

  5. #5

    Default Re: Embedded Ruby in a MSVC++ project?

    Clifford,

    Sorry, I'm not sure how to tweak VS to this degree. I'd suggest the
    newsgroup mentioned in the last msg.

    [I'm really not a good GUI user, I use the free .NET Framework SDK
    command line tools, and a programmer's editor. Anyway, I'm more
    interested in getting Ruby IL compilers for .NET first, then getting
    Ruby working in Visual Studio.]

    I'll try to ask around and see if I can get some more success with Ruby
    language support.

    Since we're talking about tweaking VS, there is a new tool that might be
    interesting to you:

    PowerToys for Visual Studio
    [url]http://www.gotdotnet.com/team/ide/[/url]

    "PowerToys for Visual Studio .NET 2003 are a collection of cool
    utilities and tools developed by Microsoft that enhance Visual Studio.
    This initial collection of PowerToys will allow you to fine-tune Visual
    Studio's hidden registry settings, add comments and build help files,
    load files from the command line and create custom IDE window layouts.
    All of the PowerToys for Visual Studio .NET 2003 releases also include
    the source code for you to freely modify and distribute to your hearts
    content."

    ps: Ben, sorry for misunderstanding your original VC question.

    -----Original Message-----
    From: Clifford Heath [mailto:cjh_nospammanagesoft.com]
    Sent: Thursday, September 18, 2003 5:16 PM
    To: ruby-talk ML
    Subject: Re: Embedded Ruby in a MSVC++ project?

    Lee Fisher wrote:
    > Recently, the VS team added a new free level to this VSIP program.
    That's great news, thanks Lee.

    I have a much simpler VS question. In Tools->Options->Text Editor, there
    is a list of supported languages. You can set the indenting depths and
    tab usage for each language. Lots of folk here are editing Ruby using
    VS, but there doesn't appear to be a way to add Ruby as a recognised
    language - obviously not for debugging purposes but even for editing.
    Anyone have a clue how to fix this? It seems amazing to me that a
    sophisticated IDE like this doesn't have extensible editor settings...

    Clifford.

    Lee Fisher Guest

  6. #6

    Default Re: Embedded Ruby in a MSVC++ project?

    >[I'm really not a good GUI user, I use the free .NET Framework SDK
    >command line tools, and a programmer's editor. Anyway, I'm more
    >interested in getting Ruby IL compilers for .NET first, then getting
    >Ruby working in Visual Studio.]
    Are you working on such a compiler?
    Some previou somewhere? ;)
    gabriele renzi Guest

  7. #7

    Default Re: Embedded Ruby in a MSVC++ project?

    Hi,

    At Fri, 19 Sep 2003 08:43:07 +0900,
    Ben Giddings wrote:
    > In fact, things seem to be working well, but I can't seem to load the Ruby
    > file. I've tried with the file in the project directory, as well as in the
    > Debug directory, but Ruby doesn't seem to find it. Any suggestions on how
    > I can figure out Ruby's load-path? (Normally I'd do rb_p("$:") or
    > something similar, but since this is a GUI project I don't know where
    > stdout/stderr go).
    Do you call rb_init_loadpath()? And you will need to call
    $stdout.reopen to use rb_p().

    --
    Nobu Nakada

    nobu.nokada@softhome.net Guest

Similar Threads

  1. RUBY Project in West Bengal (India)
    By Sabyasachi Mustafi in forum Ruby
    Replies: 6
    Last Post: November 4th, 09:56 PM
  2. Fun ruby project needs developers
    By Mike in forum Ruby
    Replies: 1
    Last Post: November 1st, 01:55 AM
  3. Project suggestion: Ruby code indenter
    By Gavin Sinclair in forum Ruby
    Replies: 5
    Last Post: October 11th, 10:53 AM
  4. stdout in embedded ruby in win32
    By thierry wilmot in forum Ruby
    Replies: 6
    Last Post: September 12th, 02:18 PM
  5. Ruby on an embedded ARM processor
    By Brian Candler in forum Ruby
    Replies: 6
    Last Post: July 15th, 05:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139