Jump to content
  • Advertisement


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


Is this an DLL problem?

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

Hi! I''ve been working my DLL based engine for some time now, and I have ran in to a few problems whit STL... NOTE: I use dlls as statically linked so I dont use load librarys or anything like that. And c++ First this function crashes in dll if its called outside the dll.
void Pusher(vector<COLOR>& vec)
 vec.push_back(COLOR()); // assertion fails, invalid pointer


// and the calling code "in the exe":

vector<COLOR> rainbow;

And Here''s another one wich I tested long time A go so it might not be a real problem but I''l show it any way.

void DrawText(string text)
 // in this example DXDrawText takes char* as first parameter and int length as second.

 DXDrawText(text.c_str(),text.lenght()); // accessing text in any way crashes the app


// and the calling code wich shouldn''t be to much wrong:

string str = "text wich never got to the screen...";

So my brilliant conclusion is that classes doesn''t work whit dlls.....?

Share this post

Link to post
Share on other sites
Using classes with DLL is very error prone in practice. I advise against it whenever possible. That being said, it is possible to use STL objects in DLLs, you just need to properly export the classes. For an example of the syntax necessary to do this take a look at this article from MSDN.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!