Advertisement

pointing to variables in a dll from an exe

Started by September 05, 2000 03:30 PM
3 comments, last by CiscoKid 24 years, 4 months ago
can anyone help me out here, I want to know if there is anything wrong or different about creating a pointer and setting its address to a variable in a imported DLL or in the opposite dirrection having a pointer in a dll point to a variable in the exe Thanks, CiscoKid Edited by - ciscokid on 9/5/00 3:39:23 PM
Worked for me...

Passing pointers around I believe is OK, although you might get weird problems if you start mixing where you allocate/free memory. Experiments are the way to go!
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
Advertisement
Hey, while we are on the subject on .dll''s.

I can make a .dll file with Borland command tools, but i dont know how do use it/link it whatever! Anyone?

=======================
Game project(s):
www.fiend.cjb.net
=======================Game project(s):www.fiend.cjb.net
You need to be careful with using variables in a DLL. Yes it is very feasible and possible to use static variables in a DLL. The reason is because the DLL is loaded into the same address space as the calling program (obviously).

What you have to be incredibly careful about though is unloading the DLL while you still have program variables referencing data in the DLL. This is a very common problem with pointers in programs that call functions in a DLL which return memory.

- Dire Wolf
direwolf@digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
To link a DLL you may need an export library from the DLL. Its a .lib file that allows you to link your application without link errors, and lets your application know that the DLL will be loaded at runtime (providing you have it on disk of course )

CodeMonkey
CODE Monkey

This topic is closed to new replies.

Advertisement