Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ShadowMaster

Pointers and Dlls

This topic is 5797 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've written an OpenGl "engine" for my game, which is loaded in runtime without the use of a .lib file.. My game aslo uses Dll's, loaded the same way, for "Mods" The pipeline is a pointer class which is taken from the Render dll and then put to the mods to use.. c_Pipe * pipe = 0; GetClass(pipe); //void GetClass( c_Pipe ** my_pipe); StartMod(&pipe); //void StartMod( c_Pipe ** my_pipe); It all works fine untill I exit my Mod.. after that any time I try to use my render class I get an Unhandeled Exeption : "Access Error"... how do I use these pointers so that this does not happen?? Thanks.. -Shadow http://nap.mega.net.kg [edited by - shadowmaster on December 4, 2002 11:45:17 PM]

Share this post


Link to post
Share on other sites
Advertisement
umm damb... I've done a sort of "work around" but as I think the problem is a simple pointer misuse, I'd realy like to know where I went wrong.. If I did not explain properly please tell me and I'll give it another go..

-Shadow


http://nap.mega.net.kg



[edited by - shadowmaster on December 6, 2002 10:18:06 AM]

Share this post


Link to post
Share on other sites
I dont particular have the answer you need, but try visiting:

http://www.flipcode.com/tutorials/tut_dll01.shtml

It contains a very good / basic explanation of how to create and load dll files properly which should hopefully solve your problem.

Hope this helps, Kiel.

Share this post


Link to post
Share on other sites
sounds like you''re using the mod after you''ve unloaded it. use the call stack and see which part of your code causes the access violation.

Share this post


Link to post
Share on other sites
Just wondering. Are the dlls being loaded into the exe process, or being run as a seperate processes? If they are seperate then all data/info inside the dll has its own virtual memory location, which can actually have the same addresses as the exe (or most often not). The point is, if its not part of the exe process you can run into all sorts of address translation problems.

If you use LoadLibrary() this is should load your dll into your calling process. And are you loading the render.dll in the mod? You should load all dll''s from the exe (since this is the main calling process).

If you are not manually loading in the dll, then it is pretty likely the dll''s are not running in the exe thread and is the cause of your problems.

Hope this all helps. Check out LoadLibrary() on msdn for more info.

Share this post


Link to post
Share on other sites
dlls don't own memory, processes do. dlls can't be run, only executables can.

each process gets its own copy of every dll it loads in its own address space.

no module (exe/dll) can have the same base address as any other module in any given process.

all resources allocated by a process, such as a loaded dll, belong to that process.

you don't have to load dlls from exes. where did you get this idea from?

he said he was loading dll explicitly at runtime.

conclusion: none of what you said has any use.

[edited by - niyaw on December 7, 2002 7:28:37 AM]

Share this post


Link to post
Share on other sites
Well my render classes are loaded from the render.dll, called from the main Exe, and are used in the exe and a when running the mod, are sent to the mod.. the problem is, i think, that when I unload the mod''s dll.. it clears my render classes in the exe.. if my render classes are NULL then when I use them the error comes up..
Like I said I made a work around, by creating a nother class specialy for using in the Mods, wich calls the render funtions from it, rather than giving direct access to the mod..

will look at LoadLibrary() on msdn tho, that should be worth a look any way..

Thanks!
-Shadow



http://nap.mega.net.kg

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!