Windows includes

100 views
Skip to first unread message

rri...@gmail.com

unread,
Jun 4, 2015, 1:23:58 PM6/4/15
to cppsha...@googlegroups.com
Before my question, here there are a couple of suggestions:
1. Please specify in the readme.md that Python *must* be installed to compile Clang and LLVM.
2. The nuget package for CppSharp is missing all the native dlls which are required at runtime. (those dlls must not be added as references but available in the executable folder)



Now my question
I have written some .h files (no .c or .cpp) which I would like to call from C#.

The first .h is a wrapper around the Security Identifier Windows APIs.
My .h is something like this:
---------------------------------------------------
#pragma once
#include <Windows.h>
#include <sddl.h>
#include <memory>
#include <vector>
#include <string>

namespace raf_windows
{
using namespace std;

class SecurityIdentifier
{
...
};
}
---------------------------------------------------


And the driver library is the following (shortened):

---------------------------------------------------
public void Setup(Driver driver)
{
var options = driver.Options;
options.LibraryName = "Raf1";
options.GeneratorKind = GeneratorKind.CSharp;

options.Headers.Add("SecurityIdentifier.h");
options.addIncludeDirs("blahblah/include");// my path
foreach (var include in _includes)
{
options.addSystemIncludeDirs(include); // adding vc include paths
}
options.OutputDir = "Raf1";
options.Verbose = true;

// the IgnoreHeadersWithName apparently is ignored ... why????
driver.ASTContext.IgnoreHeadersWithName("oaidl.h");
}
---------------------------------------------------


How can I recover from these errors?
(the first error on oaidl.h is on the definition of the VARIANT type, VARIANT_BOOL bool)

----------------------------------------------------------------
Error parsing 'SecurityIdentifier.h'
.....\include\um\oaidl.h(473,31): error: cannot combine with previous 'type-name' declaration specifier
.....\include\um\propidl.h(318,38): error: cannot combine with previous 'type-name' declaration specifier
.....\VC\INCLUDE\type_traits(133,1): error: redefinition of '_Is_memfunptr<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall))>'
.....\VC\INCLUDE\type_traits(133,1): error: redefinition of '_Is_memfunptr<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) const>'
.....\VC\INCLUDE\type_traits(133,1): error: redefinition of '_Is_memfunptr<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) volatile>'
.....\VC\INCLUDE\type_traits(133,1): error: redefinition of '_Is_memfunptr<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) const volatile>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)), type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) const, type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) volatile, type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) const volatile, type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall)), type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall)) const, type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall)) volatile, type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(74,1): error: redefinition of '_Result_of<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall)) const volatile, type-parameter-0-3, type-parameter-0-4...>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall))>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) const>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) volatile>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*)(type-parameter-0-2...) __attribute__((thiscall)) const volatile>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall))>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall)) const>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall)) volatile>'
.....\VC\INCLUDE\xrefwrap(645,1): error: redefinition of '_Refwrap_impl<type-parameter-0-0 (type-parameter-0-1::*const)(type-parameter-0-2...) __attribute__((thiscall)) const volatile>'
----------------------------------------------------------------

Thank you in advance,
Raf

João Matos

unread,
Jun 22, 2015, 5:19:56 PM6/22/15
to cppsha...@googlegroups.com, rri...@gmail.com, rri...@gmail.com
Hey,

I have no idea how to fix that parsing error. We rely on the Clang parser so could you give standalone Clang compiler a try and report if it works?
Reply all
Reply to author
Forward
0 new messages