Hi,
da mir die leute im C++ Forum nicht helfen konnten frag ich mal hier:
kann es irgendwie sein, das Singletons in DLLs die auch in der EXE funktionieren sollen, sich nicht leiden können?
Ich hab nen Singleton in ner DLL (in der DLL funzt er prima!) und will ihn auch in der EXE benutzen, doch da gibbet irgendwie zur laufzeit streit mit ner Error-MessageBox:
Test.exe - Einsprungpunkt nicht gefunden
Der Prozedureinsprungpunkt "?setFile@exLog@@QAEXPBD@Z" wurde in der DLL "EagleX.dll" nicht gefunden.
oder ist mein Singleton einfach nur falsch gecodet?
Hier der code:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// Dateiname: EagleX.h
// //////////////////////////////////////////////////////////////////////////////////
// Autor: Patrick Ullmann (c) by Xarent Interactive 2003
//
// Erstelldatum: 22.07.2003
// letzte Änderung: 22.07.2003 (Patrick) Datei erstellt.
// //////////////////////////////////////////////////////////////////////////////////
// Info: Header der EagleX Engine
// //////////////////////////////////////////////////////////////////////////////////
// M A K R O S //////////////////////////////////////////////////////////////////////
#ifdef EAGLEX_EXPORTS
#define EAGLEX_API __declspec(dllexport)
#else
#define EAGLEX_API __declspec(dllimport)
#endif
// I N C L U D E S //////////////////////////////////////////////////////////////////
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <string>
#include <fstream>
// I N C L U D E S - E A G L E _ X ////////////////////////////////////////////////
#include "exLog.h"
|
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Dateiname: exLog.h
// //////////////////////////////////////////////////////////////////////////////////
// Autor: Patrick Ullmann (c) by Xarent Interactive 2003
//
// Erstelldatum: 22.07.2003
// letzte Änderung: 22.07.2003 (Patrick) Datei erstellt.
// //////////////////////////////////////////////////////////////////////////////////
// Info: Protokollstruktur
// //////////////////////////////////////////////////////////////////////////////////
#ifndef _EXLOG_H_
#define _EXLOG_H_
// I N C L U D E S //////////////////////////////////////////////////////////////////
// Noch keine
// D E F I N I T I O N E N //////////////////////////////////////////////////////////
// Noch keine
// S T R U K T U R E N //////////////////////////////////////////////////////////////
class EAGLEX_API exLog
{
public:
static exLog &getInstance (void) { return (m_Instance); }
void setFile (const char *FileName = "Protokoll.txt");
exLog& operator<< (const char* s);
private:
exLog (void);
static exLog m_Instance;
std::ofstream m_Stream;
std::string m_FileName;
};
#endif
|
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Dateiname: exLog.cpp
// //////////////////////////////////////////////////////////////////////////////////
// Autor: Patrick Ullmann (c) by Xarent Interactive 2003
//
// Erstelldatum: 22.07.2003
// letzte Änderung: 22.07.2003 (Patrick) Datei erstellt.
// //////////////////////////////////////////////////////////////////////////////////
// Info: Protokollstruktur
// //////////////////////////////////////////////////////////////////////////////////
// I N C L U D E S //////////////////////////////////////////////////////////////////
#include <EagleX.h>
// D E F I N I T I O N E N //////////////////////////////////////////////////////////
exLog exLog::m_Instance;
// F U N K T I O N E N //////////////////////////////////////////////////////////////
exLog::exLog(void)
{
}
void exLog::setFile (const char *FileName)
{
this->m_FileName = FileName;
this->m_Stream.open (this->m_FileName.c_str(), std::ios::out);
this->m_Stream << "Protokolldatei:\n\n";
this->m_Stream.close ();
}
exLog& exLog::operator<< ( const char* s )
{
this->m_Stream.open (this->m_FileName.c_str(), std::ios::out | std::ios::app);
this->m_Stream << s;
this->m_Stream.close ();
return (*this);
}
|
was ist falsch? Ich kapier das vorne und hinten nicht mehr wieso der Singleton sich net mit der DLL verträgt
![:(](wcf/images/smilies/sad.png.pagespeed.ce.R_Dlrl8CWi.png)
der ist doch richtig...