How would I use rundll32.exe to run a pyd?

135 views Asked by At

I made a .pyd file with this source:

def hello():
    print("Hello world")

and I want to run hello() from rundll32 (Or any C code in general)

I tried rundll32 hello.pyd,hello() and rundll32 hello.pyd,hello but neither worked

I also looked through the C code, and did not find anything useful

1

There are 1 answers

1
Florent On

Don't use rundll32 but use C.

Inspect your hello.pyd as a dll with this tool : http://www.nirsoft.net/utils/dll_export_viewer.html

So you will see : if your file is a real .dll.

If it is real DLL :

  • you will see what is exported in your hello.pyd
  • you can use IMPLIB to produce a .lib file for linking .

http://docwiki.embarcadero.com/RADStudio/Sydney/en/IMPLIB.EXE,_the_Import_Library_Tool_for_Win32

  • declare your function in your c source for example

    void hello();