Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Using Dll's in Rgss

Okay I made my own windows library in c#. I was wondering if its possible to use this in RGSS. If it is possible, how would I go doing it?

Any help is appreciated. Thanks ^^
 
Thanks so much Seph! You rock!

EDIT: Okay So here's my source code for the library made in c#.

Code:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

 

namespace TestLib

{

    public class Log

    {

        public void WriteLine(string line)

        {

            using (var log = new StreamWriter(File.OpenWrite("test.txt")))

            {

                log.WriteLine(line);

                log.Close();

            }

        }

    }

}

How would I call the WriteLine method? I'm kind of confused... Here's how I tried it.

Code:
DLL_Function = Win32API.new('TestLib', 'WriteLine', 'string line', 'returnvalues')

 

DLL_Function.call('hello!')

The dll is called TestLib
 
try this:

Code:
DLL_Function = Win32API.new('TestLib', 'WriteLine', 'P', 'V')

 

DLL_Function.call('hello!')

The input can be one or a combination of the following:

L, I and P
where L (or l) is a long, I, (or i) is an int, and P (or p) is a pointer to a string. (P can also be used for a lot of other stuff, if you know what you're doing. For example, I've used it to pass structures to user32.dll)

If multiple input values are necessary, simply add more of these letters to the input string, one for each argument.

The output is the same as above, except you can use V (or v) to denote void output, where nothing is returned, or where return values are ignored. Just note that there can only be one output value.

By the way, to pass booleans, use integers. A 0 is false, and anything else is true.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top