• Advertisement

Archived

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

calling functions FROM the exe to the dll.

This topic is 5713 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

Hmmm, as of yet, I''ve been unable to find any vast amount of information to learn about this from, so I''ll describe my problem here in the hope that someone will be able to help me. I''ve written an engine in C++ (OOP of course), and it does pretty much everything I need it to do. Now I wanted to add a game dll file (for all the game code e.t.c). I managed to create an OOP dll with no problems, and I can call functions from the dll TO the exe without any hassle. HOWEVER.. I need the dll to be able to call engine functions. I need to be able to say, in the dll, "Load This Model using the loadModel() function in the exe". I''m pretty stumped as to how to do this (and keep it OOP). Basically I eventually want to be able to distribute the dll code so that people can mod the game e.t.c (without them having the exe code). I just dont know how to export a function virtually to the dll, so that the dll can use the CreateTexture() function, even though there is no CreateTexture() code (because it''s in the exe). An example would be for anyone who''s modded quake3, you''ll notice that calls to trap_trace are done with no trap_trace function... because that function''s in the engine, but the dll will still compile without it (using a virtual pointer to the function). I hope I''ve made it clear what I''m trying to do... I cant really progress any further with my project until I''ve got over this hurdle (and its something I REALLY should learn anyway). Thanks in advance for any help/urls/example code. ~Cobra~

Share this post


Link to post
Share on other sites
Advertisement
have a function in the dll which takes a pointer to a function table, so on startup this function is called by the exe and a table in the dll is populated by the address of the functions in teh exe (address to the start of the table pasted over), then cast the functions to an varible so you can call them (like OGL extension)

I think thats clear enuff
If in doubt, grab a copy of the HL SDK and have a look at the server dll fucntions as one of them does pretty much what I''ve said above.

Share this post


Link to post
Share on other sites
Oh.. I forgot to post here that I''ve got it working (with the help of a coder-friend hehe).

thx anyway :D

Share this post


Link to post
Share on other sites

  • Advertisement