Browse Source

Fixed a regression when generating imports of libraries with '.' in the name on Windows.

P/Invoke in .NET (on Windows) can only import libraries with '.' in the name if they are explicitly suffixed (have ".dll" at the end).

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/770/head
Dimitar Dobrev 9 years ago
parent
commit
cbb64c4c62
  1. 4
      src/CppParser/Bindings/CLI/AST.cpp
  2. 4
      src/CppParser/Bindings/CLI/AST.h
  3. 4
      src/CppParser/Bindings/CLI/CppParser.cpp
  4. 4
      src/CppParser/Bindings/CLI/CppParser.h
  5. 4
      src/CppParser/Bindings/CLI/Sources.cpp
  6. 4
      src/CppParser/Bindings/CLI/Sources.h
  7. 4
      src/CppParser/Bindings/CLI/Target.cpp
  8. 4
      src/CppParser/Bindings/CLI/Target.h
  9. 4
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs
  10. 4
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs
  11. 1070
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs
  12. 4
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs
  13. 4
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs
  14. 4
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs
  15. 4
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs
  16. 4
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs
  17. 4
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs
  18. 4
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs
  19. 1070
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs
  20. 4
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs
  21. 12
      src/Generator/Generators/CSharp/CSharpSources.cs

4
src/CppParser/Bindings/CLI/AST.cpp

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include "AST.h"
using namespace System;

4
src/CppParser/Bindings/CLI/AST.h

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#pragma once
#include "CppSharp.h"

4
src/CppParser/Bindings/CLI/CppParser.cpp

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include "CppParser.h"
#include "AST.h"
#include "Target.h"

4
src/CppParser/Bindings/CLI/CppParser.h

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#pragma once
#include "CppSharp.h"

4
src/CppParser/Bindings/CLI/Sources.cpp

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include "Sources.h"
using namespace System;

4
src/CppParser/Bindings/CLI/Sources.h

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#pragma once
#include "CppSharp.h"

4
src/CppParser/Bindings/CLI/Target.cpp

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include "Target.h"
using namespace System;

4
src/CppParser/Bindings/CLI/Target.h

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#pragma once
#include "CppSharp.h"

4
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

4
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

1070
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs

File diff suppressed because it is too large Load Diff

4
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

4
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

4
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

4
src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

4
src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

4
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

4
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

1070
src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs

File diff suppressed because it is too large Load Diff

4
src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;

12
src/Generator/Generators/CSharp/CSharpSources.cs

@ -3191,20 +3191,22 @@ namespace CppSharp.Generators.CSharp @@ -3191,20 +3191,22 @@ namespace CppSharp.Generators.CSharp
if (libName == null)
libName = declaration.TranslationUnit.Module.SharedLibraryName;
var targetTriple = Context.ParserOptions.TargetTriple;
if (Options.GenerateInternalImports)
libName = "__Internal";
else if ((targetTriple.Contains("win32") || targetTriple.Contains("win64")) &&
libName.Contains('.') && Path.GetExtension(libName) != ".dll")
libName += ".dll";
if (Platform.IsMacOS)
if (targetTriple.Contains("apple") || targetTriple.Contains("darwin") ||
targetTriple.Contains("osx"))
{
var framework = libName + ".framework";
for (uint i = 0; i < Context.ParserOptions.LibraryDirsCount; i++)
{
var libDir = Context.ParserOptions.GetLibraryDirs(i);
if (Path.GetFileName(libDir) == framework && File.Exists(Path.Combine(libDir, libName)))
{
libName = string.Format("@executable_path/../Frameworks/{0}/{1}", framework, libName);
break;
}
return $"@executable_path/../Frameworks/{framework}/{libName}";
}
}

Loading…
Cancel
Save