PgAdmin Object File cannot be empy - c

I am trying to create a C language function in pgadmin4, but I don't know what to put in object file, and link symbol.
in object file I have put this path but I don't know what else I should put.

The "object file" is the shared library you built from your C source code and installed in the PostgreSQL library directory, and the "link symbol" is the name of the exported function.
The PostgreSQL documentation has lots of information about writing C functions.

Related

How to include header AND source files folder in Visual Studio

I am using Visual Studio (2017) and I need the following.
I have a folder where a code generator puts the .h and .c files obtained from a formal model. This folder is not controlled by me, e.g. I cannot write in it, but it is updated by another team member.
By using the /I compiler options (or Additional include directories in the project properties) I managed to import all the generated header files in my VS project. What I am supposed to do is to integrate this generated code into a specific platform, this means that I have to compile both the generated code and the integration code on the target platform. The problem is, the compiler is not able to resolve the generated function definitions of the generated code as it only sees the .h files. What I got is a linking error (external symbol not resolved)
To solve the problem, I added the existing .c files manually, one by one. The obvious problems that comes with this solution are
manual boring work
when new files are generated, I need to manually import the new files
Question is: is there an option that can be set in order to specify the path of the source files without passing them one by one?
note: just copying and pasting the generated code in the VS project folder is not an acceptable solution.
Thanks
If you look at https://learn.microsoft.com/en-us/cpp/ide/working-with-project-properties?view=vs-2017 then you see there is a Source Directories property that has $(VC_SourcePath) as a default but (I think) to which you can add additional paths. The documentation is unclear whether that means all source files in such a path will be included for compilation.
At the bottom of the documentation it explains how to override certain project properties by providing an external properties file. It seems you can override the targets/sources using such a file. You can generate the file using a small tool that reads the filenames in those directories and adds them to the file.
You could also analyze the .vcproj file and build a small tool that wil re-write the part with your generated source directories, reading the filenames in those directories and adding them to the section in the .vcproj file.

Starting point of execution in sqlite

I was trying to understand sqlite source code.
I was lookin to find that, when on CLI we do $sqlite abcd.db, where does the control transfers to , which function are called?
I've to make some changes whenever I create a new database or open it i.e. $sqlite abcd.db
The amalgamation build of SQLite includes two C files. sqlite3.c is the SQLite library source code, and does not contain an entry point, since it is not a program.
The SQLite shell is implemented in the file shell.c, which is a standard C program source file with a main function (which is on line 3570 in my version).

Visual Studio referencing header and source files

I have a C project in visual studio that is named "Framework".
The Framework project is supposed to hold common code that should be shared among different projects.
I also have another project (Lets call it A) that should use code from the Framework.
Lets say the Framework project has a header called DAL.h and inside it a declaration of a function called OpenFile, this function is implemented in DAL.c.
I am trying to include DAL.h to my A project and use the OpenFile but I am receiving the following error: unresolved external symbol _OpenFile
I do understand that the compiler failed to find the implementation of OpenFile.
My question is what is the best practice in a case like the one described here ?
Should I "Add existing item" and add DAL.c to my A project ? (This fixes the error ..)
I did try to add the folder containg DAL.c to "Additional source folders" but that did not help.
Thanks a lot,
Michael.
For you to use the compiled code of the OpenFile function, it will need to exist somewhere.
You seem to have two options:
1) If you want the compiled code to be part of your binary, you will need to include the source file so it can be compiled as part of your project.
2) If you don't want it to be built into your project, and from the sound of it you don't as you say it's "common code that should be shared among different projects", the "Framework project" should compile into a library. In which case you will need to include just the DAL.h header file, and import the "Framework project" library into your project so that your project can link the OpenFile call to the implementation in the library.

How to create a header file for my existing C program in linux to connect with MySql?

it's my first time I use Linux and C programming. I've wrote a file in C language to connect with MySQL and it's working fine now. Now I've to integrate this file into my company web-based system which is written with CGI ( C ). So I guess I should make my file as a header file and call this file from the CGI. How should I create a header file ? Or is there any better way ? I google on the net but not so lucky with CGI. Can anybody help me?
I don't think that putting everything in a header file is the best solution.
Create a header file and put the
function prototypes and structure
declarations in it
Create a C file and put function definitions in it
Then you can either link with the object file obtained or you can create a dynamic library.

Can source server (Debugging Tools for Windows) be used with static library projects?

I can't find a way to use the source server tools from the Debugging Tools for Windows on a static library project,
which is built separately from the solutions actually using that library:
The output of "ssindex.cmd" always displays "zero source files found" for the PDB file generated for the library
(using compiler options /ZI and /Fd).
Running "srctool.exe -r" on this PDB displays nothing, which probably means that the PDB file does not contain any source file information.
Running the same command on the PDB file of a test application which is also build as part of the the same solution
yields a list of all expected source files.
Is there a way to use source indexing for a static library project when it should be built seperately from the solutions using it?
Thanks for any suggestions!
You can use the "/Save" and "/Load" options to store and load source information for a static library, respectively. Using these options allows you to store information for your library and then later import it when indexing a project that links against your library.
When indexing your library solution, you specify the "/Save" flag with a directory in which to store index information about the library's source files. For example (assuming you are using Subversion for source control),
ssindex.cmd /System=SVN /Save=c:\source\libproj\srcinfo /Source=c:\source\libproj /Symbols=c:\source\libproj\Release\*.pdb
When later indexing your project that includes your library, you specify the "/Load" flag with the directory containing the library's source file information. For example,
ssindex.cmd /System=SVN /Load=c:\source\libproj\srcinfo /Source=c:\source\binproj /Symbols=c:\source\binproj\Release\*.pdb
There are two potential issues that may affect your ability to use this technique. First, it appears that some source control providers may not support saving and loading source control information. I know that the Subversion provider does and it looks like the SourceSafe provider does, but I haven't checked any others.
Second, this technique appears to only work for one external static library out-of-the-box. There does not seem to be a way to load information from multiple directories and the scripts currently overwrite the contents of the directory each time you use the "/Save" option. You could probably edit the source control provider module to append to the files in the save directory rather than overwrite them, but I have not tried it.
Also, note as you mentioned above that you only need to do this if your library is being built as part of a separate solution. If the static library is part of the solution you are indexing, its source files will be included if they are in the path specified by the "/Source" option.
It probably means you haven't inputed the correct directories when running "ssindex" so for ssindex you need to have: /source=C:/SourceCode/ /symbols=C:/SourceCode/bin/Debug I'm not sure if the "source" has an upper case S or not but that should be it!
when run svnindex.cmd, it always tell you "zero source files found"
after a painful diggin into svn.pm (the perl module to deal with svn), i found that:
first, svn.pm invokes "svn info -R $SourceRoot" to get all version info of files in $SourceRoot (passed by /source option),
then svn.pm stores all files in a dictionary which using the local file path as key
svnindex.cmd call srctool -r to get all source files info in *.pdb, and use the source file name as a key to query info saved in step2
the problem is:
svn.pm uses relative path, but *.pdb uses absolute path, so you will never find a svn log info for any file, then "zero source files found"
fixup:
change svn.pm line 162:
$LocalFile = lc $1;
to   
$LocalFile = $SourceRoot . "\" . lc $1; #make path absolute

Resources