Jump to content

DllStructCreate()


Recommended Posts

Link to comment
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!

Link to comment
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?
Link to comment
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!

Link to comment
Share on other sites

Link to comment
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!

Link to comment
Share on other sites

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...