Are you a C/C++ pro, with experience of VS upgrades, willing to help me out?  (Read 746 times)

Piglet

  • 1337
  • *
  • Posts: 3029
  • Country: gb
Hi lovely people.

If there's anyone here who is a C/C++ programmer and willing to help me, please can you let me know.

It'll need to be someone with experience of large projects and particularly upgrades from VS2003/VS2005 to later versions.


I've hit a range of problems in doing an upgrade, and I don't have the experience to work out how to resolve them.

As an example of the sort of thing I'm battling with, somewhere in the code or a library the code is using there's a reference to functions that used to exist in the VS2005 versions of specific libraries that the linker cannot find when compiling with VS2022. I don't know how to find out why that function is needed and where it's been referenced.

The_Cowboy

  • 1337
  • *
  • Posts: 259
  • Country: in
  • CodeZilla
Could you share the information about what be those libraries.
Quote from: Wormbo
You learn UnrealScript mainly by reading other people's code. Removing code without an important reason (download size reduction and lack of helpfulness are not important in that sense) is extremely antisocial IMHO.

Stealer

  • Sr. Member
  • *
  • Posts: 218
  • Country: gb
    • 76561197992159424
    • Bruce Campbell
I used to be, haven't coded for over a decade though. At present I'm still trying to get my head around my current job, although I've found a niche and clientele that I can use to further my own IT bizz when I restart it... Not quite sure how cool they will be, with me offering my services whilst working for them, but at present the isp's that I work for don't offer an IT consultant :) Sadly I'm very restricted on time at the mo, only get Sundays off and 1 random day in the week.
I'll try and have a look sometime if you need help, although I can't guarantee when, sorry.
« Last Edit: March 02, 2022, 20:53 by Stealer »
"It's nice to be important, but it's more important to be nice" - Gunshot
"Chewing there, gurning and dreadlocking my pubic hair, whilst holding a cardboard sign saying its rude to stare" -Luna (Grotty by Dr Syntax)

Stealer.T32

Piglet

  • 1337
  • *
  • Posts: 3029
  • Country: gb
Could you share the information about what be those libraries.

The example issue I have is one where it's trying to pull in atls.lib. I think that library has changed and no longer contains this function in the latest VS. I'm wanting to understand what it is that makes it need this function, and what the modern equivalent is.

Code: [Select]
atls.lib(atlbase.obj) : error LNK2019: unresolved external symbol "int __cdecl ATL::_AtlInitializeCriticalSectionEx(struct _RTL_CRITICAL_SECTION *,unsigned long,unsigned long)" (?_AtlInitializeCriticalSectionEx@ATL@@YAHPAU_RTL_CRITICAL_SECTION@@KK@Z) referenced in function "public: long __thiscall ATL::CComCriticalSection::Init(void)" (?Init@CComCriticalSection@ATL@@QAEJXZ)


I need some hand-holding and help to be able to understand how to work on these sorts of things sensibly
« Last Edit: March 02, 2022, 21:56 by Piglet »

The_Cowboy

  • 1337
  • *
  • Posts: 259
  • Country: in
  • CodeZilla
Ok so here is the picture:
A function in the library ALT (that you mentioned) named
Code: [Select]
CComCriticalSection::Init()
(look at https://docs.microsoft.com/en-us/cpp/atl/reference/ccomcriticalsection-class?view=msvc-170#init)

is somehow calling a function (probably a C function linkage, that you identified)
Code: [Select]
_AtlInitializeCriticalSectionEx(args...)

Now this shouldn't normally happen (as name itself suggests). The function called (as written in the documentation) should be
Code: [Select]
InitializeCriticalSection(args...)

We need to find why alternate version of funciton is being called of which there seems be no trace. I suspect some macro setting but need to delve into that code snippet for now. Maybe some versioning riddikulus-ness (pardon my Harry Potter reference  8)).
Quote from: Wormbo
You learn UnrealScript mainly by reading other people's code. Removing code without an important reason (download size reduction and lack of helpfulness are not important in that sense) is extremely antisocial IMHO.

Kyhado

  • Newbie
  • *
  • Posts: 15
  • Country: us
Never dove into C++ and have no experience with VS project upgrades. I have scripted and built apps in VS2015. I was thinking maybe upgrading to a earlier version might help, version hop at a time, but Microsoft says it doesn't help and its better to jump to the latest 2022 VS version.

Maybe this links...

//// Upgrade C++ projects from earlier versions of Visual Studio ///

https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-170



//// Overview of potential upgrade issues (Visual C++) - LNK2019: Unresolved external ////

https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-170

hellfire

  • Sr. Member
  • *
  • Posts: 195
  • Country: fr
  • Dev, gamer, entrepreneur, good hearted&mock raging
Noob answer from limited exp:  Maybe we need to go through the change logs to see if backward compatibility is maintained. Normally, the change log always mentions what has been depreciated.

If not backward compatible, then you need to re-factor the old code and hopefully, if the return value from the function in question has the same datatype , then the only thing which might need changing , is the passed parameters/function name.

In the worst case, data types change but again everything can be patched.

You can do a ctrl+F to find out how many places the function has been called and then calculate the time required to update the old code. I did some combability update involving C ++ to another dev's code and yeah it takes time as you need to go to the fundamentals. But I normally start at the change log and compare using tools like notepad++ or a much more powerful comparison tool to find out the exact lines which has changed between the libraries (and function in question ) and start from there.

Good luck :)
« Last Edit: March 03, 2022, 13:54 by hellfire »

Piglet

  • 1337
  • *
  • Posts: 3029
  • Country: gb
I've worked out the root cause of that specific problem. It's using a very old library that I'll have to find an alternative to.

One step forward. 20 steps back.

hellfire

  • Sr. Member
  • *
  • Posts: 195
  • Country: fr
  • Dev, gamer, entrepreneur, good hearted&mock raging
Been there done that :) Good luck. A few years back I was in the middle of upgrading from old microsoft ERP solution to a new one. We ended up manually copy orders to the new system with people working over the weekend and the CEO talking to each one to beg lol. But in the end, kudos to the IT team and in a few more weeks things settled ;)