I'm pretty new to RPG Maker and Ruby but here is what I have so far:
A dll made in cpp with this code:
#include <string>using namespace std;extern "C" __declspec(dllexport) string HelloWorld(string name){ return "Hello " + name;}And a script with this code:
GetText = Win32API.new('CPPHelloWorld', 'HelloWorld', 'p', 'p')def DisplayText text = GetText.call('Bob') #$game_message.add(text) #$game_actors[$game_variables[4]].tp = text;endIf i could get either of those last two commented lines to work that would be great, I'm just trying to get text from the dll to display. However, the game crashes without an error message on the the line for GetText.call... (works fine when I comment it out). My event just runs DisplayText() then displays the the fourth variable.
I was wondering if anyone new why it was crashing or what i was doing wrong? I am trying to learn how to load dlls into ruby/rpgmaker. Also, I have tried using char arrays/pointers instead of strings in the cpp code as well.
A dll made in cpp with this code:
#include <string>using namespace std;extern "C" __declspec(dllexport) string HelloWorld(string name){ return "Hello " + name;}And a script with this code:
GetText = Win32API.new('CPPHelloWorld', 'HelloWorld', 'p', 'p')def DisplayText text = GetText.call('Bob') #$game_message.add(text) #$game_actors[$game_variables[4]].tp = text;endIf i could get either of those last two commented lines to work that would be great, I'm just trying to get text from the dll to display. However, the game crashes without an error message on the the line for GetText.call... (works fine when I comment it out). My event just runs DisplayText() then displays the the fourth variable.
I was wondering if anyone new why it was crashing or what i was doing wrong? I am trying to learn how to load dlls into ruby/rpgmaker. Also, I have tried using char arrays/pointers instead of strings in the cpp code as well.