I've read and successfully tried the answer to How can I pass a Delphi string to a Prism DLL?, but wondered if it was possible to use a similar method to pass a Delphi array of integers (static or dynamic) to a Prism DLL.
How can I pass a Delphi array of integers to a Prism DLL?
272 views Asked by Warren Stanley At
2
There are 2 answers
1
someone
On
I don't have time to write a full working example but here are the key things to adapt the example you mention in the other question:
declare a type with your buffer length
type
[MarshalAs(UnmanagedType.LPArray)]
TBuffer = array[0..-length-]of integer;
and to make operations in the buffer remember to use the "pinned" modifier
var BufferPointer: ^TBuffer; pinned;
...
BufferPointer := @the_buffer[0];
Related Questions in ARRAYS
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- What does: "char *argv[]" mean?
- How to populate two dimensional array
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- Function is returning undefined but should be returning a matched object from array in JavaScript
- The rules of Conway's Game of Life aren't working in my Javascript version. What am I doing wrong?
- Array related question, cant find the pattern
- Setting the counter (j) for (inner for loop)
- I want to flip an image (with three channels RGB) horizontally just using array slicing. How can I do it with python?
- Numpy array methods are faster than numpy functions?
- How to enter data in mongodb array at specific position such that if there is only 2 data in array and I want to insert at 5, then rest data is null
- How to return array to ArrayPool when it was rented by inner function?
- best way to remove a word from an array in a react app
- Vue display output of two dimensional array
- Undot Array with Wildcards in Laravel
Related Questions in DELPHI
- How can I read the header of request to webserver
- Receiving Notifications for Individual Task Completion OmniThreadLibrary Parallel.ForEach
- Delphi - How to get result of function from QuickReport without viewing a report?
- Out of memory while adding documents to a Firebird BLOB field with Delphi
- How to MakeScreenshot fullpage on Delphi
- How to program a COM object with an IEnumerator, IEnumerable interface inside
- How to Dynamically Add Controls to Delphi Form
- How to write a string in Stringrid with DelimitedText in FMX Delphi 11
- TGrid/TStringGrid multi cell selection / multi editing in delphi firemonkey (12)
- How to localize "Today" in the Delphi TMonthCalendar?
- How can I call a SOAP webserver method in Vue.js?
- Efficiently Handling Large Number of API Calls with Delphi 10.4 and OmniThreadLibrary
- Delphi can not compile the unit create by its "XML Data Binding Wizard"
- Save Form Properties in File and then restore those Properties after reopening
- Is it possible to open a blob without saving it to file
Related Questions in DLL
- How to find a sequence of bytes on the target program from my injected dll?
- .lib not generated when building DLL project using template class
- The file "spng.dll" is not founded in my Visual Studio's project and i get an error
- Handling Memory Allocation and Pointers in Electron between Node.js and C++ DLL
- Multi level project reference using dll
- Wix MSI Project Harvesting Error Message 'dll is not running' on Build
- Windows Custom Credential Provider is not displaying tile on logon for all users in a pc
- How can I verbosely track the whole process of calling a function?
- Is dll static var shared between threads that load the same dll?
- JNR-FFI - Callback Pointer crash
- How can I patch a function call to a Windows DLL (e.g. kernel32 LoadLibrary)? Is this even possible?
- PyInstaller with PyQt5 Generates "DLL load failed" Error for QtPrintSupport
- What happens if I link two different libraries providing the same symbols in Visual Studio?
- how to test .dll on Linux
- PHP FFI - How to free memory created by FFI::new("void*[2]", false, true)
Related Questions in DELPHI-PRISM
- DelphiPrism XE - strategies on migrating to .NET Framework 4.0 (4.8 really)
- Class..ctor() not found on a struct after porting from Delphi Prism to C#
- Thread.Resume Obsolete or decprecated: How to resume a suspended thread without using System.Threading.Thread.Resume?
- Why .net program on linux under mono fails to run?
- Is it normal for a .NET program to be using 50% of the CPU on an average all the time?
- How to retain content page controls' viewstate when changing master page?
- How to properly change a page's master page?
- RemObjects: How to prevent UI from freezing when making unsuccessful TCP/IP connection?
- Can a suspended thread be aborted?
- Can a program leak memory by setting and resetting backcolor property?
- How to preserve ViewState when changing master page of a content page?
- Delphi Prism - how do I determine actual class that TObjectExtender is "extending"
- How to programmatically press toolstripbutton down?
- Why 32 by 32 4 bit BMP cursor is not displaying?
- How to create dynamic array of DateTime?
Related Questions in OXYGENE
- Convert WP_query to manual Oxygen query OR advanced query
- DelphiPrism XE - strategies on migrating to .NET Framework 4.0 (4.8 really)
- Streaming oxygene saturation data from apple watch
- Microsoft.IdentityModel.Logging: Strong name signature could not be verified
- Why does new FileStream get access violation in REST service when path has IP Address?
- .NET equivalent to Delphi's "DebugHook" variable to test for presence of debugger
- Include Unmanaged Type attribute in COM interface
- remobjects c# share code between classes
- Load string from Delphi stream in Oxygene
- TeeChart / Android / Oxygene
- how to handle redundant classes used in web services
- How do you compare an oxygene class reference to classes?
- What is the equivalent of the Java expression "Class.class" in Oxygene?
- Refactoring tools for Oxygene
- How to add an event in Oxygene?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The simpliest (without marshalling) is to encode the array using BASE16 or BASE64 into a unicode string and pass a string.