Help On Ruby Integration With C

Hi…

I m using ruby 1.8.6 on Windows…

I m extending Ruby with C.

that is i want to load a DLL into Ruby…

but Ruby fails load my Dll…

i use visual studio.net command Prompt.

I integrate my dll namely prov.dll into C program namely pro1.c

afterthat i call those c functions through ruby .

D:\ruby_extend\pronmake>irb
irb(main):001:0> require ‘pro1’
=> true
irb(main):002:0> include Pro
=> Object
irb(main):003:0> Pro::load
=> false
irb(main):004:0>

i get only false…

dll fails to load through ruby…

how can i get the stacktrace ?

Any Advices…

Pls help me out

Thanks

below is my pro1.c code

#include “windows.h”

#include “ruby.h”

#include “pro.h”

#define _D(string) {OutputDebugString(string);}

VALUE Pro;
HINSTANCE hlibrary;

void _textline(const char s, int len)
//
***********************************
{
_D(s);
}

static VALUE p_load(VALUE self )
//******************************
{

   return pro_load();

}

static VALUE p_init(VALUE self)
//*****************************
{
_D(“-> init”);

     pro_set_textline_callback(_textline);

pro_renderInit();

}

static VALUE p_parse(VALUE self, VALUE string_to_parse)
//*****************************************************
{

_D(StringValuePtr(string_to_parse));
return pro_parse(StringValuePtr(string_to_parse));

}

void proeventcallback(proRenderEventType type, proRenderEventData data)
//************************************************************************
{
switch(type){
case proRenderEventDone:
_D(“-> cleanup”);
pro_renderCleanUp();
//if (vWindow)
//{
// SendMessage((HWND)NUM2INT(vWindow), WM_USER+2, 0, 0);
//}
}
}

static VALUE pro_render( VALUE self )
//**********************************
{

_D("-> render");

pro_set_renderevent_callback(proeventcallback);
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_ABOVE_NORMAL);
pro_render(PRO_RENDERASYNC);
return Qtrue;
}

void Init_pro1()
//***************
{

pro = rb_define_module( "Pro" );
rb_define_method(Pro, "load", p_load, 0);
rb_define_method( Pro, "init_engine", p_init, 0 );
rb_define_method(Pro, "parse", p_parse, 1);
rb_define_method(Pro, "render", pr_render, 0);

}