This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
The C bindings I'm making have some declarations like so:
ada
type syz_SineBankConfig is record
waves : access constant syz_SineBankWave; -- synthizer.h:273
wave_count : aliased Extensions.unsigned_long_long; -- synthizer.h:274
initial_frequency : aliased double; -- synthizer.h:275
end record
with Convention => C_Pass_By_Copy; -- synthizer.h:272
And as an Ada declaration I've transformed it into:
ada
type Sine_Bank_Wave is record
Frequency_Mul: Long_Long_Float;
Phase: Long_Long_Float;
Gain: Long_Long_Float;
end record;
package Sine_Bank_Waves is new Ada.Containers.Vectors(Natural, Sine_Bank_Wave);
type Sine_Bank_Config is record
Waves: Sine_Bank_Waves.Vector;
Initial_Frequency: Long_Long_Float;
end record;
I however need to be able to convert from Sine_Bank_Config
to syz_SineBankConfig
. The trouble I'm running into is that I can't seem to find a way to do this via the Ada.Containers.Vectors package itself, and there doesn't seem to be any obvious way through Interfaces.C. Should I re-declare these types as something else that's easier to convert, or is there some way I missed?
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/ada/comment...