Archived

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

problems with dll interface and <map>

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

#ifndef COGLSTATEMANAGER_H
#define COGLSTATEMANAGER_H

class cOGLStateManager
{
	//variables

private:
	std::map<unsigned int,bool> states;

	//functions

public:
	cOGLStateManager(void);
	~cOGLStateManager(void);

	virtual void OnConstruction(void);
	virtual void OnDeconstruction(void);

	bool GetState(GLenum state);
	void SetState(GLenum state,bool val);
};

#endif
this is included in main, and used in other classes before this file is included, the class is referenced class __declspec(dllimport) cOGLStateManager; when compiled, i get a warning...
------ Build started: Project: _NO_NAME_, Configuration: Debug Win32 ------

Compiling...
cOGL.cpp
d:\computer\mydocuments\Visual Studio Projects\_NO_NAME_\cOGLStateManager.h(8) : warning C4251: ''cOGLStateManager::states'' : class ''std::map<_Kty,_Ty,_Pr,_Alloc>'' needs to have dll-interface to be used by clients of class ''cOGLStateManager''
        with
        [
            _Kty=unsigned int,
            _Ty=bool,
            _Pr=std::less<unsigned int>,
            _Alloc=std::allocator<std::pair<const unsigned int,bool>>
        ]
Linking...
   Creating library Debug/_NO_NAME_.lib and object Debug/_NO_NAME_.exp

Build log was saved at "file://d:\computer\mydocuments\Visual Studio Projects\_NO_NAME_\Debug\BuildLog.htm"

darkfire - 0 error(s), 1 warning(s)


---------------------- Done ----------------------

    Build: 1 succeeded, 0 failed, 0 skipped


does anyone know how i can make this stupid warning go away?

Share this post


Link to post
Share on other sites
lmao, well i didnt want to do that, i wanted to know how to actually put the < map > in the dll interface, so its there, and it works... instead of ignoring the warning

[edited by - fireking on November 30, 2003 6:40:36 AM]

Share this post


Link to post
Share on other sites
That's the only warning I ever recommend you disable.

The STL is a bit bitchy about being exported in a DLL. However, as long as you use the same implementation of the STL in programs that use the DLL, it should be fine.

EDIT: Though if you do run into problems, the only real solution, as far as I know, is to roll your own containers to replace the STL.

[edited by - glassJAw on November 30, 2003 6:40:53 PM]

Share this post


Link to post
Share on other sites