Jump to content
  • Advertisement

Archived

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

Freaker13

sharing between dll and exe???

This topic is 5219 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 all, i'me working on a 3d engine.i've 2 projects: a static lib with base classes and a dynamic link lib for the impmentation of directx.No when i want to integrate my log class in it,i ve the folowing problem: In the init of GSaRenderer(the base class) i init my log system and in the destructor i release it.But it seems that the first log variable isn't the same than the second.They have a different address.ive tried to use shared data segments like you can see in GSaRenderer.cpp but that doesn't solved it(or i did it wrong).another strange thing is that when i call the release in the destructor of cRendererDX9_0(the dll)it's also the wrong adress
 
#include "stdafx.h"
#include "GSaRenderer.h"

//#pragma data_seg("SHARED")

GScLogger GSaRenderer::log;
//#pragma data_seg()  

//#pragma comment(linker, "/section:SHARED,RWS") 

        
GSaRenderer::GSaRenderer(HINSTANCE m_hInst)
{
	numAdapters = 0;
}

GSaRenderer::~GSaRenderer() 
{
	log->release();
}

bool GSaRenderer::init()
{
       log->addFileOutput("Renderer Log.txt",GScLog::WARNING);
	if(!log->loadStrings(".\\Renderer Data\\RendererStrings.txt"))
	{
		log->dLogS(GScLogger::FATAL,"Logger kan .\\Renderer Data\\RendererStrings.txt. niet laden.");
		return false;
	}
	if(!doInit())
		return false;

	return true;
}
[edited by - freaker13 on June 7, 2004 9:35:39 AM]

Share this post


Link to post
Share on other sites
Advertisement
Did you try to declspec the logging object as a dllexport in the library that you want to export the logging class from? Global variables will only be shared properly if the proper import and export statements are made (either through declspec in the code or other equivalent methods).

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!