A different approach to building C++ projects
rachelbythebay.com
A different approach to building C++ projects
1–10 of 74 posts
Re: A different approach to building C++ projects
#2Not always the case; I have a project with
default.o: default.yaml
$(LD) -r -b binary -o default.o default.yaml
and a default.h containing extern const char _binary_default_yaml_start[];
extern const char _binary_default_yaml_end[];
#define PARAM_YAML _binary_default_yaml_start
#define PARAM_YAML_LEN (_binary_default_yaml_end - _binary_default_yaml_start)
this used in the main code as fwrite(PARAM_YAML, 1, PARAM_YAML_LEN, stdout);
printing the contents of the yaml file to stdout.Re: A different approach to building C++ projects
#3Re: A different approach to building C++ projects
#4 #pragma comment(lib, "xxx.lib")
You can specify it in a header file for the library. That way if you include the header file, the library mentioned will automatically get linked as long as it is somewhere in the library search path.I have found myself wishing that GCC would also get something like this.
Re: A different approach to building C++ projects
#5Re: A different approach to building C++ projects
#6Re: A different approach to building C++ projects
#7This sounds like it would be fine for code that you write yourself. But if you're only compiling code you wrote then C++ build systems are pretty trivial. The hard bit is dependencies.
Re: A different approach to building C++ projects
#8Re: A different approach to building C++ projects
#9One of the nice things that Visual C++ has is #pragma comment(lib, "xxx.lib") You can specify it in a header file for the library. That way if you include the header file, the library mentioned will automatically get linked as long as it is somewhere in the library search path. I have found myself wishing that GCC would also get something like this.
cc main.c -o blaRe: A different approach to building C++ projects
#10One of the nice things that Visual C++ has is #pragma comment(lib, "xxx.lib") You can specify it in a header file for the library. That way if you include the header file, the library mentioned will automatically get linked as long as it is somewhere in the library search path. I have found myself wishing that GCC would also get something like this.
function I2C_GetNumChannels(out numChannels: Longword): FT_Result; stdcall; external 'libmpsse.dll';
and that was it; but to do this in MSVC you needed not only the .h header and the .dll itself, you also needed that stupid .lib file that had AFAYCT had literally nothing inside it except symbol entries that said "no, load it dynamically from this .dll on startup, please". So it was a rather common source of amusement for Delphi programmers that paradoxically, it was harder to link a program written in C against a DLL written in C than it was to link a program written in Delphi against a DLL written in C.