mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-21 06:10:16 +08:00
bindexplib: Add method for parsing and integrating .def
files
This commit is contained in:

committed by
Brad King

parent
4f90e79314
commit
845c482448
@@ -64,7 +64,7 @@
|
|||||||
#include "bindexplib.h"
|
#include "bindexplib.h"
|
||||||
|
|
||||||
#include <cmsys/Encoding.hxx>
|
#include <cmsys/Encoding.hxx>
|
||||||
#include <fstream>
|
#include <cmsys/FStream.hxx>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
@@ -429,6 +429,34 @@ bool bindexplib::AddObjectFile(const char* filename)
|
|||||||
return DumpFile(filename, this->Symbols, this->DataSymbols);
|
return DumpFile(filename, this->Symbols, this->DataSymbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bindexplib::AddDefinitionFile(const char* filename)
|
||||||
|
{
|
||||||
|
cmsys::ifstream infile(filename);
|
||||||
|
if (!infile) {
|
||||||
|
fprintf(stderr, "Couldn't open definition file '%s'\n", filename);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string str;
|
||||||
|
while (std::getline(infile, str)) {
|
||||||
|
// skip the LIBRAY and EXPORTS lines (if any)
|
||||||
|
if ((str.compare(0,7,"LIBRARY") == 0) ||
|
||||||
|
(str.compare(0,7,"EXPORTS") == 0)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// remove leading tabs & spaces
|
||||||
|
str.erase(0, str.find_first_not_of(" \t"));
|
||||||
|
std::size_t found = str.find(" \t DATA");
|
||||||
|
if (found != std::string::npos) {
|
||||||
|
str.erase (found, std::string::npos);
|
||||||
|
this->DataSymbols.insert(str);
|
||||||
|
} else {
|
||||||
|
this->Symbols.insert(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
infile.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void bindexplib::WriteFile(FILE* file)
|
void bindexplib::WriteFile(FILE* file)
|
||||||
{
|
{
|
||||||
fprintf(file,"EXPORTS \n");
|
fprintf(file,"EXPORTS \n");
|
||||||
|
@@ -13,6 +13,7 @@ class bindexplib
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bindexplib() {}
|
bindexplib() {}
|
||||||
|
bool AddDefinitionFile(const char* filename);
|
||||||
bool AddObjectFile(const char* filename);
|
bool AddObjectFile(const char* filename);
|
||||||
void WriteFile(FILE* file);
|
void WriteFile(FILE* file);
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user