Hi Matt,

Aliases do not solve the problem. The procedure name still exists and so 
including both iic_software and iic_hardware will lead to a 'function already 
defined' error.

If I am right an alias is only a different name for the same thing but with an 
alias you can use both the alias and the original name, correct?

Next to that iic_software uses function prototypes and so the alias has to be 
after the function prototype but then the function is already mentioned.

So the only way to solve this is - like Kiste mentioned - a find replace of 
iic_ by iic_sw for software and iic_hw for hardware iic. It is then up to the 
JAL user to either do the same or add an alias 😉.

Please correct me if I am wrong.

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens Matthew Schinkel 
<[email protected]>
Verzonden: zondag 13 februari 2022 22:47
Aan: jallib <[email protected]>
Onderwerp: [jallib] Re: Not able to use both sw IIC and hw IIC due to 
procedures having the same name.

Hi Rob, I agree. Change the i2c library variable and procedure names in both 
libs.

If there are any libraries using the i2c lib, they should not need to be 
changed. Instead, add aliases in the samples like what I've done for serial in 
many samples.

In 18f4620_sd_card.jal:
-- some aliases so it is easy to change from serial hw to serial sw.
alias serial_write is serial_hw_write
alias serial_read is serial_hw_read
alias serial_data is serial_hw_data
alias serial_data_available is serial_hw_data_available

This allows the user to switch between hardware and software libraries, or use 
both.

I don't think there is any need for a legacy library when the user can just add 
some alias lines to their sample. They'll need to change their sample either 
way.

Thanks,
Matt.

On Sunday, February 13, 2022 at 1:04:18 PM UTC-5 [email protected] wrote:
Hi all,

I got an e-mail from a Jallib user who wants to use both IIC software and IIC 
hardware. This is, however, not possible because both libraries use the same 
names in procedures and functions.

For USART the convention 'sw', 'hw' and 'hw2' is used in the procedures.

The problem is easily fixed by adding _sw_ to the software iic procedures. I 
did this for this Jallib member and gave him a modified version of 
i2c_software. But when changing this and adding this to Jallib then all sample 
files that use i2c_software should be changed and members that have made 
projects with this library should modify their programs too.

Next to that, for consistency, the i2c_hardware should also get the addition 
(in procedure names) _hw_.

What do you think? Should this be changed and if so, how?

Thanks.

Kind regards,


Rob




--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/1525e85a-c620-474a-8423-24751c38359cn%40googlegroups.com<https://groups.google.com/d/msgid/jallib/1525e85a-c620-474a-8423-24751c38359cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/DB6P195MB0183E8D548AFBA81B53B1FA3E6339%40DB6P195MB0183.EURP195.PROD.OUTLOOK.COM.

Reply via email to