-
Content Count
3711 -
Joined
-
Last visited
-
Days Won
185
Posts posted by David Heffernan
-
-
As I read the documentation, I think you are right. Well done. On the home straight now. As I said, this is fundamentally a numpy issue. No doubt a numpy expert would have been aware of this.
-
22 minutes ago, fjames said:Does this sound possible?
No.
Python buffer API gives you access to the internal buffer of Python objects. Pass that to Delphi and have your delphi code populate it.
-
It seems odd to me that you won't use the solution that I outlined above which is known to work.
But if you won't entertain that then you are probably asking in the wrong place. Because what you are asking is really a numpy question. I'd ask the question on SO and tag it python and numpy. Doesn't matter at all that the array is from Delphi. It's just an array of double.
-
2 hours ago, Dave Novo said:@Fr0sT.Brutal - do you have an example of how you can feed python with the pointer to the delphi array and then use this data in Python?
You want to do more than this don't you. You want to use numpy methods with this shared data. Is that correct?
-
2 hours ago, Fr0sT.Brutal said:You of course can feed Python with the pointer to your Delphi array but what you can do with it depends on what you want Python to do with it.
What @fjames wants to do in Python is to use numpy without copying data between Delphi and Python. Are you aware of a way to do this with numpy that I have missed?
-
I don't think there's an easy way to get numpy to use your raw array memory. My initial suggestion, I suspect, is the only tractable way to do this without copying.
-
2 hours ago, Clément said:fillchar( MyData, Sizeof(TMyData) , 0 );
move( DataFromCOM[0], MyData[0], Sizeof(TMyData) );
Beyond the compilation error which is just a typo, pointless to zeroise the record and then write over those zeros.
-
1
-
-
Something can't be both a Delphi array and a numpy array. You should do what in said. Work with a numpy array's buffer. You'll access that as a pointer in Delphi. Use pointer math.
-
If you want to work with numpy, and minimise copying, then you create a numpy ndarray array object and use the buffer protocol to gain access to the object's internal buffer. Do all your work in Delphi using that internal buffer.
-
2
-
-
If the fields are at known, fixed positions then you can read them directly. If not then you need to parse the data.
-
1
-
-
3 hours ago, Mahdi Safsafi said:HRESULT. In fact ReadProcessMemory calls an internal function that returns a HRESULT and then checks the value and returns the bytes count.
# ReadProcessMemory: # ... 203BF56E | 8B45 E8 | mov eax,dword ptr ss:[ebp-18] 203BF571 | 50 | push eax 203BF572 | 8B00 | mov eax,dword ptr ds:[eax] 203BF574 | FF50 40 | call dword ptr ds:[eax+40] # InternalReadProcessMemoryFunction that reads the bytes and returns a HRESULT 203BF577 | E8 7096FAFF | call <dbkdebugide260.@Dbkhelper@CheckRetVal$qqrxl> # check HRESULT # ... 203BF599 | 8B45 FC | mov eax,dword ptr ss:[ebp-4] # result = bytes count
Seems unlikely. The winapi functions return a BOOL and call SetLastError. HRESULT seems very implausible.
-
That's called returning a value through a parameter. If you look at this function, what else could these integer return values hold?
-
3 hours ago, Mahdi Safsafi said:I clearly understand the requirement. What I discussed with you is different thing than what I suggested to Thomas. My answers were based on your statement which used a word output (BTW you still didn't explain what you mean by that) that makes me think to binary graph.
By output I mean what is produced by the compiler.
-
17 minutes ago, Mahdi Safsafi said:It just seems to me that you didn't understand my comment.
I don't think so. I think that you don't seem to understand the requirement. You certainly can't achieve the functionality shown in the original post from a native executable file (like the ones that Delphi produce).
-
25 minutes ago, Mahdi Safsafi said:I use external debugger heavily and all what I need to find references to a given function is the executable only ... map/pdb is just a sugar.
If map wasn't that in your mind ... what's the actual one ?
A map file doesn't list functions calls. You can't map the graph of function calls from a map file.
27 minutes ago, Mahdi Safsafi said:if you parse all units you can than get the information.
Parsing isn't enough. You also need to interpret the tokens that the parser emits, using the syntax of the language.
For sure you need a parser. But it's not enough. You need more.
-
8 minutes ago, Mahdi Safsafi said:The output ... you mean map file ?
No. You need way more than a map file to find all the incoming references to a function.
12 minutes ago, Mahdi Safsafi said:You can use DelphiAST (by Roman Yankovsky) to parse the unit.
This won't tell you the information either.
-
grep is useless for this purpose. This functionality in VS works because the tooling is able to compile the code and understand all the references from the output of that compilation. A naive text match using grep will give nothing whatsoever of value.
-
18 hours ago, Mike Torrettinni said:I very rarely use anonymous functions, so I assume the limitation (compared to callback) is that it can only be used within already executed code. You can't just assign it to something, because it's anonymous (not defined anywhere). Right?
No. That makes no sense. Anonymous methods are just procedural types with variable capture.
-
8 hours ago, vhanla said:wasting more RAM
How would RAM be wasted?
-
You don't need to call Release in Delphi code. The compiler manages that for you.
-
1
-
-
35 minutes ago, Fr0sT.Brutal said:(Random(X)/X)*High(UInt64)
Absolutely not. Some UInt64 values can never be returned and the performance will be poor.
-
What will it take for Delphi programmers to give up on the idea that strings and byte arrays are the same thing!
-
14 minutes ago, julkas said:Can it be done better?
Random returns 32 bits of randomness, why only use 16 of them? In other words, can't you do this with two calls to Random rather than four.
Furthermore, Random is a pretty low grade PRNG. Depending on what you intend to use this for, you may want to use a better PRNG.
-
2
-
-
These helpers are often just copied from .net, and .net strings are immutable.
Here is the .net property: https://docs.microsoft.com/en-us/dotnet/api/system.string.chars?view=netcore-3.1
-
1
-
Interesting sort implementation, does not fit into usual API tough
in Algorithms, Data Structures and Class Design
Posted · Edited by David Heffernan
Timsort is stable, and performs well on partially ordered data. It's the default sort for Python and Java.