[Tutor] Python C extension - which method?

2018-05-05 Thread Brad M
Hi all: I want to create a C-based memory scanner for Python, and so far this is how I do it: Python: from ctypes import cdll mydll = cdll.LoadLibrary('hello.dll') print(mydll.say_something()) and hello.dll: #include __declspec(dllexport) int say_something() { return 1980; } so the pr

Re: [Tutor] Python C extension - which method?

2018-05-06 Thread Brad M
clspec(dllexport) int say_something() { return 1980; } On Sun, May 6, 2018 at 8:39 AM, Brad M wrote: > Does this have any downside? I have noticed that printf("HI") in my .DLL; > doesn't really print anything. > I am on windows. > > cdll.LoadLibrary('hello

[Tutor] ValueError: Procedure probably called with too many arguments (8 bytes in excess)

2018-05-06 Thread Brad M
Hi all: I am experimenting with python calling some .DLL and this is my setup: scan.py memscan = ctypes.WinDLL('mahdll', use_last_error=True) print(memscan.say_something(1,2)) # So I pass to int to the DLL function. DLL: #include __declspec(dllexport) int say_something(int a, int b) { print

Re: [Tutor] Python C extension - which method?

2018-05-06 Thread Brad M
er method, and then I would like to find out how to handle the data returned. (address) Thanks!!! On Sun, May 6, 2018 at 5:44 AM, Stefan Behnel wrote: > Hi, > > Brad M schrieb am 04.05.2018 um 11:30: > > I want to create a C-based memory scanner for Python, and so far this is &g

[Tutor] passing values and C pointers

2018-05-06 Thread Brad M
Hi all: Although I have college C++ 101 and Python 101 down my belt, I wan't taught how to read a reference manual to figure this out :( Say I have an array of values, say addresses or int produced by a c module/ c function that's in a DLL , how do I pass that array back to the python code? from

[Tutor] calling printf() in a C language DLL using ctypes.CDLL

2018-05-08 Thread Brad M
Hi all: I am trying out some c based module in a .dll file on windows. // helloworld.c #include __declspec(dllexport) void helloworld() { printf("Hello Everyone!!!"); } I compile this by typing this in the command line: cl /LD /I C:\python\include helloworld.c C:\python\libs\python36.lib

Re: [Tutor] calling printf() in a C language DLL using ctypes.CDLL

2018-05-09 Thread Brad M
when something went wrong or when it triggers a if condition, how do you do it? Thanks! On Wed, May 9, 2018 at 8:16 AM, eryk sun wrote: > On Tue, May 8, 2018 at 9:39 AM, Brad M wrote: > > > > I compile this by typing this in the command line: > > cl /LD /I C:\python

[Tutor] Choice of tools

2018-05-09 Thread Brad M
Hi all, I have a question about how to choose a proper IDE for C/C++ I have been using visual studio ever since my C++ 101 days, but now I realized there is a problem: feature lock-in! As an aside, I can't get "Error squiggles" to show up in my .c project in visual studio 2017, where as in my .cp

Re: [Tutor] Choice of tools

2018-05-10 Thread Brad M
Ya I am using that and the command line to compile at this point before I can get VS to work for me again. Thanks!! On Thu, May 10, 2018 at 4:32 PM, Mark Lawrence wrote: > On 09/05/18 10:10, Brad M wrote: > >> Hi all, I have a question about how to choose a proper IDE for C/C++