Vintage appMaker의 Tech Blog

[github] 파이썬 확장모듈(C++) 만들기 본문

Source code or Tip/python

[github] 파이썬 확장모듈(C++) 만들기

VintageappMaker 2020. 12. 3. 13:48

 

 

VintageAppMaker/MakePythonModule

Visual Studio 2008로 파이썬 모듈만들기. Contribute to VintageAppMaker/MakePythonModule development by creating an account on GitHub.

github.com

개발환경

  • Visual C++(2008)
  • Python2.7(화면설정은 python 2.5 screenshot)

C++로 pyd 만드는 예제. 개발환경이 10년전이긴하나, C++로 된 라이브러리를 만든다면 참고하여 자신의 개발환경에 맞게 빌드할 수 있다. 예제는 Python 소스에서 C++로 만든 확장모듈 dlog의 메소드를 사용하여 GUI(Window GUI)에 문자열을 출력하는 것이다. 

 

 

# -*- coding: cp949 -*-
import dlog
import os
 
# testing twice open
dlog.openwindow()
dlog.openwindow()
 
findlist = os.listdir("c:\\windows\\")
i = 0
for f in findlist:
    dlog.dout(f, i)
    i = i + 1
 
raw_input("아무키나 누르세요 - 윈도우 종료")
dlog.closewindow()
raw_input("아무키나 누르세요 - 윈도우 시작")
 
# testing twice open
dlog.openwindow()
dlog.openwindow()
 
findlist = os.listdir("c:\\windows\\")
i = 0
for f in findlist:
    dlog.dout(f, i)
    i = i + 1
 
Comments