chr-1x / twc Goto Github PK
View Code? Open in Web Editor NEWA C99-compatible library for using the Twitter API from cURL
License: MIT License
A C99-compatible library for using the Twitter API from cURL
License: MIT License
Can you confirm this issue on your end?
My test code is as follows:
auto tweet = "looks like @chronaldragon's twc is working :) (this tweet sent from a #dlang script)";
enforce(twc_statuses_updatee_params.init.MediaIds == null);
twc_call_result x = twc_Statuses_Update(&twitter, twc_ToString(tweet.toStringz),
twc_statuses_updatee_params.init);
writefln("%s", x.ErrorStr.Ptr[0..x.ErrorStr.Size]);
The response:
{"errors":[{"code":44,"message":"media_ids parameter is invalid."}]}
../code/twitter.c(5): fatal error C1083: Cannot open include file: 'alloca.h': No such file or directory
char* DeclName = ArgCount >= 3 ? ArgValues[3] : "code/twitter_api.h";
char* ImplName = ArgCount >= 4 ? ArgValues[4] : "code/twitter_api.c";
in codegen.c should be >= 4, >= 5
Only reproing on windows right now, but may be due to a shared bug on all platforms
There are three things using C99 features:
None of these are critical, and use of the former needs to be scoped down a lot anyway for ease of language binding. C89 compat is a reasonable target and likely opens up path for compiling on less recent compilers (e.g. older versions of MSVC)
ReadFileAndNullTerminate in codegen.c calls fopen, but never fclose
comparing to the wrong size
it should be SourceIndex < Path.Size;
'cp' is not recognized as an internal or external command, operable program or batch file.
you might have some linux tools in your path. you can use copy
instead.
In twitter.c, you should #include <alloca.h> for alloca. I get undefined references to alloca without this when trying to build my program with your library.
└──> dmd -debug -Jres/ blog.d libtwc.a -L-lcurl
libtwc.a(twitter.o): In function 'twc_GenerateOAuthSignature':
/home/mio/scripts/blog/bin/twc/code/twitter.c:700: undefined reference to `alloca'
ketmar tells me this is because of a gcc specific hack that transforms alloca into __builtin_alloca which gets inlined.
Here is a quote from man 3 alloca
Notes on the GNU version
Normally, gcc(1) translates calls to alloca() with inlined code. This is not done when either the -ansi,
-std=c89, -std=c99, or the -std=c11 option is given and the header <alloca.h> is not included. Otherwise,
(without an -ansi or -std=c* option) the glibc version of <stdlib.h> includes <alloca.h> and that contains the
lines:
#ifdef GNUC
#define alloca(size) __builtin_alloca (size)
#endif
with messy consequences if one has a private version of this function.
The fact that the code is inlined means that it is impossible to take the address of this function, or to
change its behavior by linking with a different library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.