forked from csmith-project/csmith
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import ctypes | ||
|
||
# 라이브러리 로드 | ||
csmith_function = ctypes.WinDLL('.\\csmith.dll') | ||
|
||
# 함수 프로토타입 정의 | ||
csmith_function.gen_csmith.argtypes = (ctypes.c_int, ctypes.POINTER(ctypes.c_char_p)) | ||
|
||
def make_param(str_list): | ||
c_string_array = (ctypes.c_char_p * len(str_list))() | ||
for i, string in enumerate(str_list): | ||
c_string_array[i] = bytes(string, 'utf-8') | ||
return len(str_list), c_string_array | ||
|
||
# 테스트 | ||
if __name__ == "__main__": | ||
test_strings = ["csmith", "--max-array-dim","3", "-o", "32132.c"] | ||
ret = csmith_function.gen_csmith(*make_param(test_strings)) | ||
print(ret) |