-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use the library? #224
Comments
Did you already find the documentation in the header file? If you are familiar with C and with some of the binary formats used for ECDSA, it should probably be enough: https://github.com/bitcoin/secp256k1/blob/master/include/secp256k1.h You might also want to look at my usage examples here, though they are written in Ruby and they use a future version of the library's API (the one from pull request #208): |
Keep in mind that this is currently an unreleased experimental library with a changing interfac. When it reaches a full release there will be better documentation. (DavidEGrayson's comments about the headers are the right advice now currently.) |
Thanks for the info.Unfortunately getting a bunch of errors in Xcode when I try and use any of the mehtods. I have added reference to libsecp256k1.a , the include paths, and GMP is installed via brew yet looks like it can't find GMP ? ___gmpn_gcdext? Is there a better compiler / IDE I should be using instead of Xcode? QT? Or Eclipse perhaps?
ld: symbol(s) not found for architecture x86_64 |
@ShaliDaliHaliDa : You needed to add the GNU Multiple Precision Arithmetic Library to your build command. (via -lgmp) Ex: |
And how do I compile in the library as part of my project? (not as shared library) |
Depending on the build system of your project, but the best way would probably be to invoke the |
I mean compile secp256k1.c into my exe. I tried it but it gives seg fault on context creation. |
That's exactly what I've talked about, you should compile |
Ok, so it wasn't designed to be used without linking in as a static library (.a) aka not as a black-box. |
I don't know what a "black box" means in the context of a library. But this is not a "header only library" and as such it needs to be compiled and linked (shared/static), |
Ok so how can I use it as a "header only" library? Does it require some init code before I can call context init? Because it gave me segfault. |
This is not a headers only library, you can't use it as such. You'll need to build the library, and link it into your application (either statically or dynamically). How to do that depends on the platform. I'm afraid I can't help you with usage on Windows platforms. |
Could you explain how is it possible that all of these files have main() entry points and compile into .a object? I would assume linker would complain for anything anything more than one main, which would come from post linking with user app. I'm on linux. |
Those are separate executables that are part of the project, but are not part of the library. The library itself is compiled from secp256k1.c, plus a few other files with assembly and precomputed tables. |
I manage to build it as intended, copied over generated files, it compiles, give correct result. How do you develop/debug this lib with dbg? |
@mrx23dot You need to call |
Sorry if this is a silly question but after compilation how do I use it? I found the static lib in /usr/local/lib/libsecp256k1.a and I am able to reference it, are there any examples on how to use it from Xcode?
The text was updated successfully, but these errors were encountered: