Code: Select all
struct UDT{
struct internalFormat{
int a;
int b;
} internalData;
int c;
}
Code: Select all
type internalFormat
a as long
b as long
end type
type UDT
internalData as internalFormat
int c
end type
Unfortunately, I just realized that such approach doesn't work while interfacing with code written in C++. In fact, if I have a function (for example a class member) that has a parameter of "internalFormat" type, it cannot be called from FreeBasic: the reason is that the type name is included in the function name mangled, to allow overloading, and the name of internalFormat, in the C++ code, is "UDT::internalFormat", since the type has been declared inside the type UDT. In FreeBasic, the name is just "internalFormat", and as result the linker returns an error.
So, my question is: is there a way to force the type "internalFormat" to be seen as "UDT::internalFormat", by the compiler? Otherwise, the only alternative I can figure is to manually access the mangled function name (that is very ugly to see and to declare, and makes the code prone to bugs). Also, I am trying to get rid of any sort of C wrappers, so making a wrapper is not an option.