How to load .dylib or .dll files? [Solved]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
AJFLink
Newbie
Posts: 16
Joined: Mon Nov 05, 2018 2:04 am
Contact:

How to load .dylib or .dll files? [Solved]

#1 Post by AJFLink »

I have a .dylib file and .dll files that I would like to load as libraries for Mac and Windows, respectively, in Ren'Py. What is the proper way to do this?

I possess both a MacBook laptop and Windows laptop.

On Mac for pure Python code (not Ren'Py script), you do the following (assuming that you have a path to the appropriate directory containing the .dylib file):

Code: Select all

import ctypes
ctypes.cdll.LoadLibrary("libnameoflibrary.dylib")
On Windows you do either:

1)

Code: Select all

import ctypes
ctypes.WinDLL("nameoffile.dll")
2)

Code: Select all

import ctypes
ctypes.windll.LoadLibrary("nameoffile.dll")
However, I cannot replicate this Ren'Py even in python blocks.

Post Reply

Who is online

Users browsing this forum: Google [Bot]