[Gambas-user] gb3: structure declaration not allowed in a different module

Kevin Fishburne kevinfishburne at ...1887...
Sat Nov 19 08:47:47 CET 2011


On 11/19/2011 02:42 AM, Fabien Bodard wrote:
> 2011/11/19 Kevin Fishburne<kevinfishburne at ...1887...>:
>> I had structure declarations running out of my eyes and ears across
>> about 10 modules, so I decided to create a "Structures" module to
>> contain them all. Here's an example:
>>
>> ' Gambas module file
>>
>> ' Structure module
>>
>> ' General declarations.
>>
>> ' Audio effect structure.
>> Public Struct Audio_Effect  ' Structure containing one effect's data.
>>    Sample As Sound     ' Waveform data (file).
>>    Chan As Channel     ' Default channel to play on.
>>    Current As Single   ' Current amplitude.
>>    Target As Single    ' Target amplitude.
>>    Scale As Single     ' Target amplitude multiplier.
>>    Velocity As Single  ' Speed at which current amplitude is moving
>> toward target amplitude.
>> End Struct
>>
>> In the Audio module I'd have this:
>>
>> ' General declarations.
>> Public Environment[16] As Struct Structures.Audio_Effect ' Environmental
>> effects.
>>
>> When the array attempts creation I get an error saying that "Structures"
>> wasn't a structure. It also fails if I don't specify the module name prefix.
>>
>> Why can't I create an array of structures in module A using a structure
>> defined in module B? Is there some workaround other than moving all my
>> structure definitions back into the modules which reference them?
> no... structure are dependent to the module
>
> http://gambasdoc.org/help/lang/structdecl?v3
>

That is super shitty. I'm assuming there's a good reason for that beyond 
my understanding since I've read that page so many times. What's worse 
is that I didn't back up my project prior to migrating the structure 
declarations, so I have to manually undo everything. Damn...


-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list