Skip to content

Commit

Permalink
Apparently C++ requires we do it this way.
Browse files Browse the repository at this point in the history
  • Loading branch information
MainMemory committed Mar 11, 2015
1 parent 49a75d8 commit 9bf7731
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions DLLModGenerator/MainForm.cs
Expand Up @@ -197,10 +197,7 @@ private void button5_Click(object sender, EventArgs e)
{
bool SA2 = IniData.Game == Game.SA2B;
List<string> labels = ExportCPP(writer, SA2);
writer.WriteLine("extern \"C\"");
writer.WriteLine("{");
writer.WriteLine();
writer.WriteLine("__declspec(dllexport) void __cdecl Init(const char *path, const HelperFunctions &helperFunctions)");
writer.WriteLine("extern \"C\" __declspec(dllexport) void __cdecl Init(const char *path, const HelperFunctions &helperFunctions)");
writer.WriteLine("{");
writer.WriteLine("\tHMODULE handle = GetModuleHandle(L\"{0}\");", IniData.Name);
List<string> exports = new List<string>(IniData.Items.Where(item => labels.Contains(item.Label)).Select(item => item.Export));
Expand All @@ -210,9 +207,7 @@ private void button5_Click(object sender, EventArgs e)
writer.WriteLine("\t{0} = &{1};", item.ToString(), item.Label);
writer.WriteLine("}");
writer.WriteLine();
writer.WriteLine("__declspec(dllexport) const ModInfo {0}ModInfo = {{ ModLoaderVer }};", SA2 ? "SA2" : "SADX");
writer.WriteLine();
writer.WriteLine("}");
writer.WriteLine("extern \"C\" __declspec(dllexport) const ModInfo {0}ModInfo = {{ ModLoaderVer }};", SA2 ? "SA2" : "SADX");
}
}

Expand Down
9 changes: 2 additions & 7 deletions StructConverter/MainForm.cs
Expand Up @@ -865,14 +865,9 @@ private void button5_Click(object sender, EventArgs e)
{
bool SA2 = IniData.Game == Game.SA2 || IniData.Game == Game.SA2B;
ExportCPP(writer, SA2);
writer.WriteLine("extern \"C\"");
writer.WriteLine("{");
writer.WriteLine("extern \"C\" __declspec(dllexport) const PointerList Pointers = { arrayptrandlength(pointers) };");
writer.WriteLine();
writer.WriteLine("__declspec(dllexport) const PointerList Pointers = { arrayptrandlength(pointers) };");
writer.WriteLine();
writer.WriteLine("__declspec(dllexport) const ModInfo {0}ModInfo = {{ ModLoaderVer }};", SA2 ? "SA2" : "SADX");
writer.WriteLine();
writer.WriteLine("}");
writer.WriteLine("extern \"C\" __declspec(dllexport) const ModInfo {0}ModInfo = {{ ModLoaderVer }};", SA2 ? "SA2" : "SADX");
}
}

Expand Down

0 comments on commit 9bf7731

Please sign in to comment.