I’m trying to package a c++ app into a p3d and I’m getting an access violation. I didn’t find any documentation on how to do this apart from the fact that you have to make a python wrapper, so I’m sure I’m doing something wrong.
Anyway, this is what I’m doing.
-
I changed my exe project in visual studio to dll by changing the setting, nothing else.
-
I changed my entry point from:
void main(int argc, char *argv[]) {
to
#define DLLEXPORT extern "C" __declspec(dllexport)
DLLEXPORT void main() {
At this point I get a “game.dll” file.
- I wrote the following script, main.py:
from ctypes import *
#the print is for debugging, it shows a handle correctly
print windll.game
windll.game.main()
And I get an access violation when running it on the main() call.
So, before I waste a day figuring out how to debug the native dll from python, am I missing something trivial?
EDIT: Just for the record, I also tried like this, same result:
from ctypes import cdll
mydll = cdll.LoadLibrary('game.dll')
mydll.main()