N
Nilbert Nullingsworth
Hey guys, I am extending ruby in a C++ program. I have all the headers
set up and stuff so it compiles without error, but I do get one
warning (MSVC Express 2008):
c:\visual studio 2008\projects\remoteexec\remoteexec\rubyheaders\ruby/
missing.h(154) : warning C4273: 'vsnprintf' : inconsistent dll linkage
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(350) :
see previous definition of 'vsnprintf'
Because it doesn't keep it from compiling, I don't think this is the
source of my problem. The problem is, when I call ruby_init() to start
the interpreter, the program instantly terminates. Run by the command
line, it looks like this:
C:\Visual Studio 2008\Projects\remoteExec\Release>project.exe
C:\Visual Studio 2008\Projects\remoteExec\Release>
As you can see, it does nothing. There are no errors, even though my
code is wrapped in a try/catch thing. Here is the C++ Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include "ruby.h"
using namespace std;
int main() {
//copied from teh internetz
/*HWND hWnd = GetConsoleWindow();
ShowWindow(hWnd, SW_HIDE);*/
try {
ruby_init();
} catch (char* e) {
cout << e;
}
system("PAUSE");
return 0;
}
This code isn't supposed to do anything, it's just confining the error
to that one line. No error is outputted and the program does not pause
after executing the try/catch, like it should with system("PAUSE").
Does anyone know why it is just stopping the program when ruby_init()
is called? I am using the ruby 1.9 libs and headers and stuff.
set up and stuff so it compiles without error, but I do get one
warning (MSVC Express 2008):
c:\visual studio 2008\projects\remoteexec\remoteexec\rubyheaders\ruby/
missing.h(154) : warning C4273: 'vsnprintf' : inconsistent dll linkage
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(350) :
see previous definition of 'vsnprintf'
Because it doesn't keep it from compiling, I don't think this is the
source of my problem. The problem is, when I call ruby_init() to start
the interpreter, the program instantly terminates. Run by the command
line, it looks like this:
C:\Visual Studio 2008\Projects\remoteExec\Release>project.exe
C:\Visual Studio 2008\Projects\remoteExec\Release>
As you can see, it does nothing. There are no errors, even though my
code is wrapped in a try/catch thing. Here is the C++ Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include "ruby.h"
using namespace std;
int main() {
//copied from teh internetz
/*HWND hWnd = GetConsoleWindow();
ShowWindow(hWnd, SW_HIDE);*/
try {
ruby_init();
} catch (char* e) {
cout << e;
}
system("PAUSE");
return 0;
}
This code isn't supposed to do anything, it's just confining the error
to that one line. No error is outputted and the program does not pause
after executing the try/catch, like it should with system("PAUSE").
Does anyone know why it is just stopping the program when ruby_init()
is called? I am using the ruby 1.9 libs and headers and stuff.