TulipCharts / tulipindicators

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

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

Closed Uzaaft closed 1 year ago

Uzaaft commented 1 year 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 1 year 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 1 year 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 1 year ago

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

codeplea commented 1 year ago

It should be fixed now.

Uzaaft commented 1 year ago

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