Posted on 1999-11-08
To my understanding, if you call a dll from a program it goes out of scope immediately after the call. Is there any way to keep variables inside the dll from loosing their data? Basically what I need to do is make 2 different calls to a dll. First, I want to make one call to set up some initialization parameters. This would probably be done just once. After this, however, I would need to make multiple calls to a routine in the dll to actually perform some operations using the initialization data. Since the initialization may be time consuming, I don't want to do it on every call to the second routine. As you can see, I would need the initialization data to remain in memory. Is this possible with a dll? Maybe it already works this way if you have a global in the dll?
Also, I'd like an example of how to use a dll from within c. Any example that sends parameters and gives a return will be OK. This part should be pretty easy but I'll give a couple extra points if it's done. I've created c dlls and called them from VB before but never called them from c. I assume it's similiar with some type of Declare statement but if it's not, please let me know.
BTW, MS Visual C++ 6.0 compiler with standard c code.