C++ & Excel & Win32Ole stranginess

Hi all,
I’m trying to export data to excel from my C++ program, using
embedded ruby & WIN32OLE (since I have no idea how to do it from
C++). Somehow WIN32OLE prevents my program
from exiting, and also leaves Excel process running on (EXCEL.EXE shows
in task manager).

Here is my attempt to reproduce the error in minimal amount of code:

=== c++ code
#include “stdafx.h”
#include <ruby.h>

int main(int argc, char* argv[])

return 0;


=== test.rb
require “win32ole”

app = WIN32OLE.new(“Excel.Application”)

I’m using Win2000, Excel 2000, Ruby 1.6.6, Win32ole 0.4.8, MS VC++ 6.0
I tested Word also - same behaviour.

I tried calling rb_exit(0) at the end of my program, however even
though it remedied this particular problem, it also broke uninitialization
of some libraries I’m using and therfore introduced memory leaks.

Ideas anyone?

Tomek ‘Alva’ Wroblewski (alv@poczta.onet.pl)

alv@poczta.onet.pl (Alva) wrote in message news:58883906.0208031040.7085615d@posting.google.com

Well, anybody else experiencing it? Maybe it’s just my config which
is screwed?

Tomek ‘Alva’ Wroblewski (alv@poczta.onet.pl)