My library problem
-
- Posts: 222
- Joined: 09 Apr 2011 11:08
- Location: ITALY / NAPOLI
My library problem
hello to you in the forum, I found myself in a somewhat complex problem, in practice I wrote two libraries in the same functions, but that difference that one uses a uses spi spi device and software, the problem arises now because I wrote a third library that uses these functions written in the first two, and in practice based on the type of spi used the third library should use the first or the second library, I hope I explained well enough.
Re: My library problem
Hi,
I believe you have been answered on the other topic regarding the same issue.
Regards,
Filip.
I believe you have been answered on the other topic regarding the same issue.
Regards,
Filip.
-
- Posts: 222
- Joined: 09 Apr 2011 11:08
- Location: ITALY / NAPOLI
Re: My library problem
I'm sorry , could you indicate where ??
Re: My library problem
The solution to your problem is to use function pointer in your third library. That way you can choose which function will be called from the first two libraries.
Example:
Regards
Example:
Code: Select all
typedef Tfun as sub procedure (dim b as byte)
sub procedure fun1(dim b as byte) ' function from the first library
...
end sub
sub procedure fun2(dim b as byte) ' function from the second library
...
end sub
dim MyFun as ^Tfun
const ver = 1
main:
if ver = 1 then
MyFun = @fun1
else
MyFun = @fun2
end if
MyFun(0x01)
end.