Attempt at allowing to use C++ structures in C only code: We use the
CreateAsmStructOffsetsHeader mechanism to generate a header with macros
defined to the sizes of the structures we're interested in and when compiling
in C mode define the structures as "struct { char bytes[size]; }".
It works in principle, but due to how jam works, one would have to specify the
dependency to the generated header for all sources that include it directly or
indirectly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34441 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_KERNEL_CPP_STRUCTS_H
|
||||
#define _KERNEL_KERNEL_CPP_STRUCTS_H
|
||||
|
||||
|
||||
#include <util/kernel_c.h>
|
||||
|
||||
#include <kernel_c++_struct_sizes.h>
|
||||
// this is the generated defining macros for the structure sizes
|
||||
|
||||
|
||||
// in C++ mode include the headers defining the structures
|
||||
#ifdef __cplusplus
|
||||
# include <condition_variable.h>
|
||||
#endif
|
||||
|
||||
// in C mode define the structures
|
||||
DEFINE_KERNEL_CPP_STRUCT(ConditionVariable)
|
||||
|
||||
|
||||
#endif // _KERNEL_KERNEL_CPP_STRUCTS_H
|
||||
Reference in New Issue
Block a user