TDME2
1.9.121
src
tdme
tools
cli
msclib2dll-main.cpp
Go to the documentation of this file.
1
#include <set>
2
#include <string>
3
#include <vector>
4
5
#include <
tdme/tdme.h
>
6
#include <
tdme/application/Application.h
>
7
#include <
tdme/engine/Version.h
>
8
#include <
tdme/os/filesystem/FileSystem.h
>
9
#include <
tdme/os/filesystem/FileSystemInterface.h
>
10
#include <
tdme/utilities/Console.h
>
11
#include <
tdme/utilities/Exception.h
>
12
#include <
tdme/utilities/StringTokenizer.h
>
13
#include <
tdme/utilities/StringTools.h
>
14
15
using
std::set;
16
using
std::string;
17
using
std::vector;
18
19
using
tdme::application::Application
;
20
using
tdme::engine::Version
;
21
using
tdme::os::filesystem::FileSystem
;
22
using
tdme::os::filesystem::FileSystemInterface
;
23
using
tdme::utilities::Console
;
24
using
tdme::utilities::Exception
;
25
using
tdme::utilities::StringTokenizer
;
26
using
tdme::utilities::StringTools
;
27
28
29
void
processFile
(
const
string
& fileName) {
30
Console::println(
"Processing file: "
+ fileName);
31
vector<string> fileContent;
32
FileSystem::getInstance()->getContentAsStringArray(
"."
, fileName, fileContent);
33
StringTokenizer
lineStringTokenizer;
34
auto
symbolsMode =
false
;
35
set<string> symbols;
36
for
(
auto
i = 0; i < fileContent.size(); i++) {
37
auto
line = fileContent[i];
38
line = StringTools::trim(line);
39
if
(symbolsMode ==
false
) {
40
if
(StringTools::endsWith(line,
" public symbols"
) ==
true
) {
41
symbolsMode =
true
;
42
i++;
43
}
44
}
else
{
45
if
(line.empty() ==
true
) {
46
symbolsMode =
false
;
47
}
else
{
48
lineStringTokenizer.
tokenize
(line,
" "
);
49
if
(lineStringTokenizer.
hasMoreTokens
() ==
true
) lineStringTokenizer.
nextToken
();
50
if
(lineStringTokenizer.
hasMoreTokens
() ==
true
) symbols.insert(lineStringTokenizer.
nextToken
());
51
}
52
}
53
}
54
vector<string> newFileContent;
55
newFileContent.push_back(
"EXPORTS"
);
56
for
(
auto
& symbol: symbols) newFileContent.push_back(
"\t"
+ symbol);
57
FileSystem::getInstance()->setContentFromStringArray(
"."
, fileName +
".def"
, newFileContent);
58
}
59
60
int
main
(
int
argc,
char
** argv)
61
{
62
Console::println(
string
(
"msclib2dll "
) + Version::getVersion());
63
Console::println(Version::getCopyright());
64
Console::println();
65
66
if
(argc != 2) {
67
Console::println(
"Usage: msclib2dll path_to_file"
);
68
Console::println(
"Note: path_to_file can be obtained from dumpbin /LINKERMEMBER xyz.lib"
);
69
Application::exit(1);
70
}
71
72
processFile
(argv[1]);
73
}
Application.h
Console.h
Exception.h
FileSystemInterface.h
FileSystem.h
StringTokenizer.h
StringTools.h
Version.h
tdme::application::Application
Application base class, please make sure to allocate application on heap to have correct application ...
Definition:
Application.h:37
tdme::os::filesystem::FileSystem
File system singleton class.
Definition:
FileSystem.h:14
tdme::utilities::Console
Console class.
Definition:
Console.h:26
tdme::utilities::StringTokenizer
String tokenizer class.
Definition:
StringTokenizer.h:19
tdme::utilities::StringTokenizer::nextToken
const string & nextToken()
Definition:
StringTokenizer.h:55
tdme::utilities::StringTokenizer::tokenize
void tokenize(const string &str, const string &delimiters)
Tokenize.
Definition:
StringTokenizer.cpp:14
tdme::utilities::StringTokenizer::hasMoreTokens
bool hasMoreTokens()
Definition:
StringTokenizer.h:48
tdme::utilities::StringTools
String tools class.
Definition:
StringTools.h:20
main
int main(int argc, char **argv)
Definition:
msclib2dll-main.cpp:60
processFile
void processFile(const string &fileName)
Definition:
msclib2dll-main.cpp:29
tdme::utilities::Exception
std::exception Exception
Exception base class.
Definition:
Exception.h:19
tdme::engine::Version
Version.
Definition:
Version.h:16
tdme::os::filesystem::FileSystemInterface
File system interface.
Definition:
FileSystemInterface.h:24
tdme.h
Generated by
1.9.3