TulipCharts / tulipindicators

Technical Analysis Indicator Function Library in C
https://tulipindicators.org/
GNU Lesser General Public License v3.0
818 stars 154 forks source link

Question: Why add indicators.h candles.h indicators.c candles.c into final library #126

Closed Uzaaft closed 8 months ago

Uzaaft commented 8 months ago

I've got a question: Why is the indicators.h candles.h indicators.c candles.c files added to the final library when running make libindicators.a ? I bumped into this while creating rust bindings, and the fact that the source code + header files were included seemed to cause issues at my end.

codeplea commented 8 months ago

I'm not sure what you mean.

indicators.c and candles.c are compiled into object files, along with all of the actual indicator code files (e.g. indicators/bbands.c) and added to the library. The header files aren't compiled by themselves or added to the library in any separate way. How else could it even work?

Uzaaft commented 8 months ago

So I compiled the repository as is with make libindicators.a and when I run ar -t libindicators.a, I get out a list, with the few first entries being:

indicators.h
candles.h
indicators.c
candles.c
abs.o
...

Now, from my understand(very limited compared to yours), static libraries should generally only contain object files. When I tried to run my wrapper with the default implementation, I got:

  = note: ld: archive member 'indicators.h' not a mach-o file in '/Users/uzaaft/projects/tulip-rs/tulipindicators/libi

Which for me seemed weird, so I had to look, tried to remove all .c and .h files from the command, and compiled again, and it worked, and the tests passed.

I hope this gives you a fuller image of what issue I met. Sorry if it seems lacking in regards of details, I typed this on my phone

codeplea commented 8 months ago

You're right. Thanks for bringing this to my attention. I will fix it.

codeplea commented 8 months ago

It should be fixed now.

Uzaaft commented 8 months ago

Side effect: I can now compile the whole project! Appreciate the quick help!