Author Topic: Address UNICODE 64-bit VS2015  (Read 23728 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrice Terrier

  • Hero Member
  • *****
  • Posts: 934
  • User-Rate: +62/-1
  • Gender: Male
    • www.zapsolution.com
Address UNICODE 64-bit VS2015
« on: January 18, 2017, 12:35:55 PM »
James--

Here is the WIP project, to work with UNICODE and 64-bit.
EXE binary size: 24 Kb

Not done yet:
- dynamic array to replace vector. (search for //zizi for the things to do)

Tools.h with my new LTRIM, RTRIM, TRIM (any) functions.

...
« Last Edit: January 18, 2017, 06:57:51 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Re: Address UNICODE 64-bit VS2015
« Reply #1 on: January 18, 2017, 03:02:39 PM »
Patrice,
  WOW! 24Kb
There is a LOT of source code in there to produce such a small exe!
Does this mean you are a fan of TCLib :)

James

Offline Patrice Terrier

  • Hero Member
  • *****
  • Posts: 934
  • User-Rate: +62/-1
  • Gender: Male
    • www.zapsolution.com
Re: Address UNICODE 64-bit VS2015
« Reply #2 on: January 18, 2017, 04:32:09 PM »
The problem is:
We have to check thorougly each of the function being used to avoid embedding exta code.

Especially when dealing with strings or any oher facilities like Vector.

We have to write our own, but the result is this tiny piece of code that is back to the origin of C, the time where one single exe could fit on a single floppy disk ;)

Hutch will feel very frustrated when seing 64-bit UNICODE code that is able to create smaller exe file than his belowed PB 32-bit ANSI.  ;D
« Last Edit: January 18, 2017, 04:38:12 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Mike Lobanovsky

  • Jr. Member
  • **
  • Posts: 92
  • User-Rate: +1/-1
  • Gender: Male
Re: Address UNICODE 64-bit VS2015
« Reply #3 on: January 18, 2017, 06:02:46 PM »
<OT>

Hutch will feel very frustrated when seing 64-bit UNICODE code that is able to create smaller exe file than his belowed PB 32-bit ANSI.  ;D

Oh, you're exhibiting the competition and sportsmanship egos of your inner character I've never suspected to exist! ;D

</OT>
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Re: Address UNICODE 64-bit VS2015
« Reply #4 on: January 18, 2017, 06:22:05 PM »
Patrice,
  I could not find the vector code ??
new/delete are fine for classes as they call the constructor/destructor but for arrays we also need realloc so calloc/realloc/free seem to be more in line.
I have array code from the bcx/bc9 RTL that does DIM,REDIM, and REDIM PRESERVE that should work.
I'll post a c++ demo shortly

James

Offline Patrice Terrier

  • Hero Member
  • *****
  • Posts: 934
  • User-Rate: +62/-1
  • Gender: Male
    • www.zapsolution.com
Re: Address UNICODE 64-bit VS2015
« Reply #5 on: January 18, 2017, 06:51:12 PM »
In order to enable the FindDialog, and avoid
LNK2001 unresolved external symbol __chkstk

add this to Linker, Input, Additional Dependencies
chkstk.obj;Winspool.lib;TCLib.lib;kernel32.lib;user32.lib;gdi32.lib;comctl32.lib

Quote
DIM,REDIM, and REDIM PRESERVE
That would be nice if you have it, because this is the last thing to add to the attachmnent
see:
Code: [Select]
void Array_Resize(IN long maxenties) {
//zizi        gAddressBook.resize(gP.maxentries);
}

void Array_Erase(IN long entry) {
//zizi        gAddressBook.erase(gAddressBook.begin() + gP.currententry -1);
}
« Last Edit: January 18, 2017, 06:57:11 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Re: Address UNICODE 64-bit VS2015
« Reply #6 on: January 18, 2017, 07:09:17 PM »
Patrice,
  Give this a try.
Not commented but you should be able to follow it.

Re:  unresolved external symbol __chkstk
I chased this this too and ended up with a compile or link option I believe.
I do not have it manually added.
Take a look at my batch file.

Have you tested if code not used in an #include file is added to the exe?
I know any code in the main cpp file that's not used  is not added but am not sure on #include's

James

 
« Last Edit: January 18, 2017, 08:55:44 PM by James C. Fuller »

Offline Frederick J. Harris

  • Hero Member
  • *****
  • Posts: 914
  • User-Rate: +16/-0
  • Gender: Male
    • Frederick J. Harris
Re: Address UNICODE 64-bit VS2015
« Reply #7 on: January 19, 2017, 09:54:06 AM »
Quote
We have to write our own, but the result is this tiny piece of code that is back to the origin of C, the time where one single exe could fit on a single floppy disk

One of the most absolute and fundamental goals of my TCLib work was that it be capable of using the capabilities of the C++ language.  I never considered C to be any substitute for a high level language and definitely not a substitute for PowerBASIC.  That's why in my very earliest work on this after I saw I could get both a "Hello, World!" console program and a Windows GUI up and running in 2560 bytes in x64, I immediately started experimenting with my String Class, which uses C++ new and delete in the typical manner, and of course uses C++ Classes.  The final step was in many ways getting my templated Dynamic Multi-Dimensional Array Class working, which was no work at all.  It simply worked as is with no special modifications required by TCLib.

About that whole chkstk thing; I recall running into difficulties with that at some point.  It got some mention in various sources I was using.  I'll have to review that later.  Just now I forget.  Getting old too! :(

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Re: Address UNICODE 64-bit VS2015
« Reply #8 on: January 19, 2017, 11:05:57 AM »
Fred,
  Do you have a c++  array class for use with TCLib not using any STL (vector)?

James

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Re: Address UNICODE 64-bit VS2015
« Reply #9 on: January 19, 2017, 12:01:11 PM »
Fred,
  I found it. No redim or redim preserve simulation is probably why I forgot.
James

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Re: Address UNICODE 64-bit VS2015
« Reply #10 on: January 19, 2017, 03:11:17 PM »
Patrice,
  This might be another vector substitute:
http://www.anyexample.com/programming/cplusplus/cplusplus_dynamic_array_template_class.xml
I needed to remove the throw's as we don't have exception handling with TCLib.

James
 

Offline Frederick J. Harris

  • Hero Member
  • *****
  • Posts: 914
  • User-Rate: +16/-0
  • Gender: Male
    • Frederick J. Harris
Re: Address UNICODE 64-bit VS2015
« Reply #11 on: January 19, 2017, 05:51:26 PM »
Quote
No redim or redim preserve simulation is probably why I forgot

Right.  I just never bothered coding it.  Its highly doable though.

Offline Patrice Terrier

  • Hero Member
  • *****
  • Posts: 934
  • User-Rate: +62/-1
  • Gender: Male
    • www.zapsolution.com
Re: Address UNICODE 64-bit VS2015
« Reply #12 on: January 19, 2017, 05:54:08 PM »
I have been thinking of something based on hidden.....   LISTBOX(s)
i use it very often, for quick array replacement (PlayList) , very easy to add, sort, remove, erase one line/record or a group of lines/records.
I even use 2 or more // LISTBOX to store extra informations, using a leading one to handle them all.
And the good things with it, is that i do not have to mess with all the memory management, Windows does all the hard work for me.  8)

Can do also the same with a hidden ListView, using a specific column for each of the field.

...
« Last Edit: January 19, 2017, 06:05:29 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Re: Address UNICODE 64-bit VS2015
« Reply #13 on: January 19, 2017, 06:32:11 PM »
Patrice,
  While the listbox should work fine for strings how would you use it for arrays of structures?
I really think the aedynarray link I posted minus the throws will do fine as a vector substitute for me.
I have REDIM,REDIM PRESERVE as part of bc9Basic. I can use that for multi-dimensional should I need it.

James

Offline Patrice Terrier

  • Hero Member
  • *****
  • Posts: 934
  • User-Rate: +62/-1
  • Gender: Male
    • www.zapsolution.com
Re: Address UNICODE 64-bit VS2015
« Reply #14 on: January 19, 2017, 06:40:57 PM »
For the purpose of the address demo, ListView makes much sense because it is also very common to display a database in table mode :)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com