Giter Club home page Giter Club logo

Comments (7)

baklava151 avatar baklava151 commented on June 3, 2024

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.

atilaneves avatar atilaneves commented on June 3, 2024

I can't do much unless you have a specific example that doesn't work.

from dpp.

baklava151 avatar baklava151 commented on June 3, 2024

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.

atilaneves avatar atilaneves commented on June 3, 2024

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.

baklava151 avatar baklava151 commented on June 3, 2024

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.

atilaneves avatar atilaneves commented on June 3, 2024

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.

baklava151 avatar baklava151 commented on June 3, 2024

Fair enough, I'll close this then and finagle around with it.

from dpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.