Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Today's Messages (on)  | Unanswered Messages (off)

Forum: U++ SQL
 Topic: postgresql mingw
Re: postgresql mingw [message #51765 is a reply to message #51763] Mon, 20 May 2019 02:25
mtdew3q is currently offline  mtdew3q
Messages: 96
Registered: July 2010
Location: Upstate, NY
Member
Hi all-
So I thought while I am trying to figure out what in the world is going on with PostgreSQL with mingw in U++ I had another idea. Everyone knows that mingw can be used with other frameworks so I tried to fire up libpqxx. Here is my printout:

checking for pkg-config... /mingw64/bin/pkg-config
configure: using PostgreSQL headers at c:/pgsql/include
configure: using PostgreSQL libraries at c:/pgsql/lib
checking c:/pgsql/include/libpq-fe.h usability... yes
checking c:/pgsql/include/libpq-fe.h presence... yes
checking for c:/pgsql/include/libpq-fe.h... yes
checking for ability to compile source files using libpq... yes

So everything was going great until with my bright idea tried to use the version 12 development branch and that is newer than the libpqxx on GitHub.

Well, I need pgsql to work so I will try to compile a different version of postgres with mingw.

I had to do some nifty configuring to get that to work. It (libpqxx configure script) couldn't find libraries or headers so I made one of these files (libpq.pc):
refix=/c/pgsql
exec_prefix=${prefix}/bin
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: postgresql
Description: DB
Requires:
Version: 12.0
Libs: -Lc:/pgsql/lib
Cflags: -Ic:/pgsql/include

I hope that helps anyone wanting to get into SWIG with U++ and libpqxx. That way you can use tkinter with python and C++ or just Tk and C++ all with postgres.

I will return at a little later time once I get another version set up and see what I can't figure out about why I couldn't get U++ up and running with postgres on mingw.

Hope you are having a cool weekend. I am on a 3 day weekend. It has been fun.
thnx

later - Roboloki
Forum: ScatterDraw & ScatterCtrl
 Topic: [Feature request] Gap in line at NaN values
Re: [Feature request] Gap in line at NaN values [message #51766 is a reply to message #51762] Mon, 20 May 2019 10:09
Maginor is currently offline  Maginor
Messages: 3
Registered: May 2019
Junior Member
That is awesome, thanks! I was worried that this would be much more work.
Forum: Newbie corner
 Topic: Memory leaks ?
Memory leaks ? [message #51767] Mon, 20 May 2019 13:49
Xemuth is currently offline  Xemuth
Messages: 47
Registered: August 2018
Location: France
Member
Hello Community,

Today I write a simple piece of code :
int main(int argc, const char *argv[])
{
	if(argc >0 && Upp::String(argv[0]).Find("@" ) != -1 ){
		Upp::String arg = Upp::String(argv[0])  ;
		arg.Replace("@"," ");
		Upp::String exeToLaunch = arg.Left(arg.Find(";"));
		Upp::String WhereToGet =arg.Right(arg.GetCount()-(arg.Find(";")+1)); //Here I got my both path
			if(Upp::FileCopy(WhereToGet.ToStd().c_str(),exeToLaunch.ToStd().c_str())){
			    STARTUPINFO si;
			    PROCESS_INFORMATION pi;
			    ZeroMemory( &si, sizeof(si) );
			    si.cb = sizeof(si);
			    ZeroMemory( &pi, sizeof(pi) );
			    // Start the child process. */
			    std::cout << "process creation ! \n";
				if( CreateProcess(exeToLaunch.ToStd().c_str(),   // No module name (use command line)
							       	NULL,        // Command line
							        NULL,           // Process handle not inheritable
							        NULL,           // Thread handle not inheritable
							        FALSE,          // Set handle inheritance to FALSE
							        0,              // No creation flags
							        NULL,           // Use parent's environment block
							        NULL,           // Use parent's starting directory 
							        &si,            // Pointer to STARTUPINFO structure
							        &pi )           // Pointer to PROCESS_INFORMATION structure
							    ) 
				{ 
					WaitForSingleObject(pi.hProcess,INFINITE);
					cout << "succes !" <<"\n";
				} 
				else
				{
					cout <<"error"<<"\n";
				}                       
			}
	}
}


this code work like a charm but at the end of it I have this thing : https://img.raymond.cc/blog/wp-content/uploads/2009/08/stopped_working_no_WER.png
Seems to be a memory leak but I really don't see from what it come.

After few tests I figured out that it could come from this :
Upp::FileCopy(WhereToGet.ToStd().c_str(),exeToLaunch.ToStd().c_str())

Someone with more experience than me could help ? Very Happy

Thanks in advance

have a good day !
Re: Memory leaks ? [message #51768 is a reply to message #51767] Mon, 20 May 2019 14:14
Xemuth is currently offline  Xemuth
Messages: 47
Registered: August 2018
Location: France
Member
OK, I have fixed my probleme by using :

CopyFile(WhereToGet.ToStd().c_str(),exeToLaunch.ToStd().c_str(),FALSE)

instead of
Upp::FileCopy(WhereToGet.ToStd().c_str(),exeToLaunch.ToStd().c_str())


Does it mean Upp::FileCopy is not working as intended or don't clean is memory allocation properly ?

Thanks for you responses.

Best Regard.



Current Time: Mon May 20 17:35:22 CEST 2019

Total time taken to generate the page: 0.01168 seconds