pl_mpeg icon indicating copy to clipboard operation
pl_mpeg copied to clipboard

Modify public struct typedefs to enable fwd declaration in C++

Open tomasandrle opened this issue 5 years ago • 0 comments

It would be helpful to change

typedef struct {
...
} plm_frame_t;

into

typedef struct plm_frame_t {
...
} plm_frame_t;

This would make it easier to forward-declare the structs in a C++ header without including pl_mpeg.h from there, exposing it to the rest of the program.

Example my.hpp:

struct plm_frame_t; // trying to not include pl_mpeg.h here

class MyClass {
public:
    void render( plm_frame_t *frame );
};

Example my.cpp:

#include "my.hpp"
#define PL_MPEG_IMPLEMENTATION
#include "pl_mpeg.h"

MyClass::render( plm_frame_t *frame ) {
...
}

tomasandrle avatar Aug 09 '19 23:08 tomasandrle