Comments (7)
I tried to make a reduced test case, but it seems to work fine then. I'll keep digging and see if I can get a more precise reason why it's failing.
from dpp.
I can't do much unless you have a specific example that doesn't work.
from dpp.
Just read the project description a bit closer again and realized you mentioned the following
"The only supported C preprocessor directive is #include."
which would explain why the following wasn't behaving. Are there plans to expand this?
// issue.dpp
#include <stdio.h>
#ifdef SOMETHING
#include "issue.h" // SOMETHING is never defined but this gets included anyways
#endif
void main()
{
S s = S(5);
printf("%d\n", s.x);
}
// issue.h
#ifndef ISSUE_H
#define ISSUE_H
typedef struct _S {
int x;
} S;
#endif
from dpp.
Are there plans to expand this?
No, especially since I can't imagine a situation in which that would be needed. I'm not sure why you're trying to use the preprocessor in a .dpp file for conditional compilation. D has version
for that:
version(SOMETHING) {
#include "issue.h"
}
from dpp.
That was just what was in the source code I'm messing around with porting. I attempted with version(SOMETHING) and that doesn't work. I'm guessing this is because #include is processed before version.
from dpp.
It depends where SOMETHING comes from. It depends on what you're trying to do.
The purpose of dpp is to enable #including C header files, not to aid in the translation of a C source file. If you already have a C source file, then compile it and call the functions that are implemented in it from a .dpp file.
from dpp.
Fair enough, I'll close this then and finagle around with it.
from dpp.
Related Issues (20)
- Wrong function argument type translation HOT 1
- core.stdc definition conflicts with ldc2 HOT 5
- typedef leads to multiple definitions of the same struct
- LPCWSTR and other strings are translated to ints HOT 1
- Ugly code for anonymous union inside struct HOT 3
- size_t, diffptr_t and others are translated to fixed size types HOT 1
- SuiteSparse GraphBLAS.h works with a minor issue HOT 2
- unknown type name 'uint32_t' HOT 4
- 1 test fails HOT 2
- how to pass flags: -std=c++11 HOT 1
- Error: Not valid D: cuda_runtime_api.h failed in dpp-0.4.10 (dpp-0.4.4 was ok)
- docs.d(9,45): Error: no property `raw_comment` for type `const(clang.Cursor)` HOT 1
- Error: declaration expected, not `#` on macOS with default cpp
- dpp silently drops first symbol of include path HOT 1
- (Issue or wish) Some versions of libclang on Windows silently ignores typedef of anonymous structs HOT 1
- Compilation failure using DMD 2.102.
- need a new release as current one is broken with current dmd
- Windows: dllexport/dllimport variables not emitted properly
- ENH: parse C++ pure virtual function, and if a class only contains C++ pure virtual function, translate to D interface. HOT 3
- ENH: add dpp build-in support for int64_t? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dpp.