sharing between dll and exe???

Started by
0 comments, last by Freaker13 19 years, 10 months ago
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]
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).

This topic is closed to new replies.

Advertisement