Sign in to follow this  
Followers 0
Yashied

DllStructCreate()

10 posts in this topic

#1 ·  Posted (edited)

Share this post


Link to post
Share on other sites



Well you save the amount of memory that need to be allocated/freed during runtime. However I don't know if I should recommend it since I can see bugs/problems comming up.

The better question is, in what situation do you want to do so and why?


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

The better question is, in what situation do you want to do so and why?

There is a large structure, in which I want to change only one parameter. The main program may be periodically to call DllCall() with this structure. From this arises this question. + Speed increase?

Share this post


Link to post
Share on other sites

It depends how large the structure is, if it's in the megabytes range and the program calls the code constantly then I would say the speed increase is worth it.

Why not do a quick benchmark to see how much time it takes to allocate the memory?


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Yes, it's more stable and it's the way the functions are designed. However if your application is performance critical then I don't see the problem with saving some cpu time by allocating memory in the beginning of the script.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

This is what I usually do... :)

Global Const $struct = "ptr balhh;int woow;"
; Heaps of code goes here....  
$r = DllStructCreate ($struct)

Cheers,

Brett

I mean ...

Global Const $r = DllStructCreate("ptr balhh;int woow")
DllStructSetData($r, "balhh", ...)
etc.
; Heaps of code goes here....
Edited by Yashied

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

You are basically asking is it ok (not senseless) to declare the structure in the global scope.

And if you repeat that few times in your self, the answer should come by it self.

Real question is where the fear comes from? (Yes, I know the answer)

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0