-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with "Struct" in external function definition: Syntax error - expecting ','. #627
Comments
Changing above to: test.bmx: SuperStrict
Framework brl.standardio
Import "aud.bmx"
Extern
Function test_struct:Int(f:Byte Ptr, chan:Int) = "int test_struct(struct mystruct*, int)"
Function test:Byte Ptr() = "char* test()"
EndExtern
Print "here" aud.bmx: SuperStrict
Framework brl.basic
Import "external.h" so defining in test.bmx but importing header in the import file Attention: "GW" (who reported that issue at discord) uses "Framework brl.basic" in the import file. This leads to:
(the duplicate defs could be ... fiddled with by using an ifdef... yet I wonder why it is imported twice). Removing the framework leads to just the duplicate def one - but it "compiled" in the sense of not throwing and finally: SuperStrict
Framework brl.standardio
Import "external.h"
Extern
Function test_struct:Int(f:Byte Ptr, chan:Int) = "int test_struct(struct mystruct*, int)"
Function test:Byte Ptr() = "char* test()"
EndExtern
Print "here" outputs:
|
If you comment out So: Extern
'Function test_struct:Int(f:Byte Ptr, chan:Int) = "int test_struct(struct mystruct*, int)"
Function test:Byte Ptr() = "char* test()"
EndExtern it will compile too. So it stumbles only over the "struct" part of the external function declaration. |
wrapping the external.h stuff in "ifndef" to avoid duplicate definitions ... external.h: #include <stddef.h>
#include <stdint.h>
#ifndef EXTERNAL_H
#define EXTERNAL_H
struct mystruct {
size_t something;
};
int test_struct(struct mystruct *f, int chan);
static struct mystruct myfa={0};
char* test()
{ return &myfa; }
int test_struct(struct mystruct *fa, int chan) {
return 0;
}
#endif disabling the "problematic external function definition" (also removing the framework command - as it adds another error/warning): aud.bmx
and keeping test.bmx the same:
still outputs:
|
Parser probably isn't expecting "struct" there in |
Use the following files:
test.bmx:
aud.bmx:
external.h:
(readymade zip: imp_test.zip )
Output:
The text was updated successfully, but these errors were encountered: