atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
230 stars 31 forks source link

reopening namespaces #113

Closed Laeeth closed 5 years ago

Laeeth commented 5 years ago

when namespaces are reopened then have problems with forward declaration. I think need to gather all declarations in each namespace and open an extern(C++) extern(C++,"foo") extern(C++,"bar") for everything in foo.bar namespace rather than reopening as currently happens.

atilaneves commented 5 years ago

Could you provide an example please? D doesn't need forward declarations at module scope, so I can't see how this would come about.

Laeeth commented 5 years ago

Try autowrapping any non trivial C++ project using my fork. (yours won't finish because it will choke on things I just turn into an opaque). You will see what I mean. I will create test case if /when time.

Laeeth commented 5 years ago

The problem is that D forbids forward declarations!

It comes about via recursive header imports.

Example - try include bondconvention.h

atilaneves commented 5 years ago

I googled bondconvention.h but didn't find anything. Is is this open source?

Laeeth commented 5 years ago

I sent you a link before. Git.kaleidic.io Xenoncpp

atilaneves commented 5 years ago

The problem is that D forbids forward declarations!

D forbids more than one declaration. Forward declarations are fine as long as they're the only one.

atilaneves commented 5 years ago

Command to try it:

./d++ --include-path ~/kaleidic/xenoncpp/Analytics/Analytics.Rates --include-path ~/kaleidic/xenoncpp/Analytics/Analytics.Numerical --include-path ~/kaleidic/xenoncpp/Analytics/Dlang/cpp --include-path ~/kaleidic/mir-algorithm/include --parse-as-cpp --ignore-macros xenon.dpp
atilaneves commented 5 years ago

For now I'm hitting a lot of unstranslatable cursors from boost but not anything to do with namespaces.