Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. TCHAR porting issues while porting from VC6 to VC8

TCHAR porting issues while porting from VC6 to VC8

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharpvisual-studioquestion
16 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rajesh_Parameswaran
    wrote on last edited by
    #1

    Hi all, I'm using Visual Studio 2005. I have a workspace in visual C++ 6.0 which provides a set of library functions[DLL]. I have a client application which uses one of the function in the library. This client was working perfectly in VC6.0, but when I ported to VC8, it started showing link error: Signature of the Function in the library[DLL] Header: ULONG sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId); Implementation of the Function in the library[DLL] Source: ULONG NIHAI_TAPI::sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId) { .... .... .... } Client Application Call: TCHAR messageParameters[MESSAGES_PARAMS][MESSAGE_SIZE]; ULONG netCallId; bool request; returnCode = tapiConnection.sendInfo(request, messageParameters, netCallId); But I'm getting a link error: nihai_worker.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall NIHAI_TAPI::sendInfo(bool,unsigned short (* const)[81],unsigned long)" (__imp_?sendInfo@NIHAI_TAPI@@QAEK_NQAY0FB@GK@Z) referenced in function "private: unsigned long __thiscall NIHAI_Worker::sendToTAPI(unsigned int,unsigned short (* const)[81],unsigned long)" (?sendToTAPI@NIHAI_Worker@@AAEKIQAY0FB@GK@Z) Kindly suggest a resolution for the above problem. Thanks in Advance. regards, Rajesh

    I CPalliniC 3 Replies Last reply
    0
    • R Rajesh_Parameswaran

      Hi all, I'm using Visual Studio 2005. I have a workspace in visual C++ 6.0 which provides a set of library functions[DLL]. I have a client application which uses one of the function in the library. This client was working perfectly in VC6.0, but when I ported to VC8, it started showing link error: Signature of the Function in the library[DLL] Header: ULONG sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId); Implementation of the Function in the library[DLL] Source: ULONG NIHAI_TAPI::sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId) { .... .... .... } Client Application Call: TCHAR messageParameters[MESSAGES_PARAMS][MESSAGE_SIZE]; ULONG netCallId; bool request; returnCode = tapiConnection.sendInfo(request, messageParameters, netCallId); But I'm getting a link error: nihai_worker.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall NIHAI_TAPI::sendInfo(bool,unsigned short (* const)[81],unsigned long)" (__imp_?sendInfo@NIHAI_TAPI@@QAEK_NQAY0FB@GK@Z) referenced in function "private: unsigned long __thiscall NIHAI_Worker::sendToTAPI(unsigned int,unsigned short (* const)[81],unsigned long)" (?sendToTAPI@NIHAI_Worker@@AAEKIQAY0FB@GK@Z) Kindly suggest a resolution for the above problem. Thanks in Advance. regards, Rajesh

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      One thing I know (there are soooome others) is that VC6 defaulted to not-unicode, and VC8 defaults to unicode. TCHAR means different things depending on the defines. So your program could be thinking TCHAR = wchar_t (ie, short), while the lib you're linking against was compiled with TCHAR = char, and the two decorated functions no longer match... So, to resolve it, you need to make sure both of your chunk of codes agree on what TCHAR means. Iain.

      Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

      CPalliniC 1 Reply Last reply
      0
      • R Rajesh_Parameswaran

        Hi all, I'm using Visual Studio 2005. I have a workspace in visual C++ 6.0 which provides a set of library functions[DLL]. I have a client application which uses one of the function in the library. This client was working perfectly in VC6.0, but when I ported to VC8, it started showing link error: Signature of the Function in the library[DLL] Header: ULONG sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId); Implementation of the Function in the library[DLL] Source: ULONG NIHAI_TAPI::sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId) { .... .... .... } Client Application Call: TCHAR messageParameters[MESSAGES_PARAMS][MESSAGE_SIZE]; ULONG netCallId; bool request; returnCode = tapiConnection.sendInfo(request, messageParameters, netCallId); But I'm getting a link error: nihai_worker.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall NIHAI_TAPI::sendInfo(bool,unsigned short (* const)[81],unsigned long)" (__imp_?sendInfo@NIHAI_TAPI@@QAEK_NQAY0FB@GK@Z) referenced in function "private: unsigned long __thiscall NIHAI_Worker::sendToTAPI(unsigned int,unsigned short (* const)[81],unsigned long)" (?sendToTAPI@NIHAI_Worker@@AAEKIQAY0FB@GK@Z) Kindly suggest a resolution for the above problem. Thanks in Advance. regards, Rajesh

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        It seems a UNICODE vs ANSI build conflict, i.e. VC8 project makes UNICODE builds by default, while VC6 makes ANSI ones. Possibly you have a ANSI DLL and a UNICODE client. Try to change the client setting: choose Project->Properties menu item, then select Configuration Properties->General node and finally change the Character Set switch. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • I Iain Clarke Warrior Programmer

          One thing I know (there are soooome others) is that VC6 defaulted to not-unicode, and VC8 defaults to unicode. TCHAR means different things depending on the defines. So your program could be thinking TCHAR = wchar_t (ie, short), while the lib you're linking against was compiled with TCHAR = char, and the two decorated functions no longer match... So, to resolve it, you need to make sure both of your chunk of codes agree on what TCHAR means. Iain.

          Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          u 2 fast -> i 2 drugz. :-D

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

          In testa che avete, signor di Ceprano?

          I 1 Reply Last reply
          0
          • CPalliniC CPallini

            u 2 fast -> i 2 drugz. :-D

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

            I Offline
            I Offline
            Iain Clarke Warrior Programmer
            wrote on last edited by
            #5

            Well, I'm waiting for a colleague to finish a bit of work so I can carry on, so I'm pouncing for a little while. And I like to race you. Of course, while I was typing my last response, Cedric wrote a better and faster answer than me. Boo Cedric, Boo! Iain. ps, Noone's delivered your urgent drugs yet?

            Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

            C CPalliniC 2 Replies Last reply
            0
            • I Iain Clarke Warrior Programmer

              Well, I'm waiting for a colleague to finish a bit of work so I can carry on, so I'm pouncing for a little while. And I like to race you. Of course, while I was typing my last response, Cedric wrote a better and faster answer than me. Boo Cedric, Boo! Iain. ps, Noone's delivered your urgent drugs yet?

              Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              Iain Clarke wrote:

              Of course, while I was typing my last response, Cedric wrote a better and faster answer than me. Boo Cedric, Boo!

              Why don't we have a devil emoticon when we need it ? ;P

              Cédric Moonen Software developer
              Charting control [v1.4]

              1 Reply Last reply
              0
              • I Iain Clarke Warrior Programmer

                Well, I'm waiting for a colleague to finish a bit of work so I can carry on, so I'm pouncing for a little while. And I like to race you. Of course, while I was typing my last response, Cedric wrote a better and faster answer than me. Boo Cedric, Boo! Iain. ps, Noone's delivered your urgent drugs yet?

                Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

                CPalliniC Offline
                CPalliniC Offline
                CPallini
                wrote on last edited by
                #7

                Iain Clarke wrote:

                Boo Cedric, Boo!

                Definitely! That guy is too smart.

                Iain Clarke wrote:

                ps, Noone's delivered your urgent drugs yet?

                Nope my friend...But since you are such a nice guy, ...plz plz plz urgent!!! :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                In testa che avete, signor di Ceprano?

                C 1 Reply Last reply
                0
                • CPalliniC CPallini

                  Iain Clarke wrote:

                  Boo Cedric, Boo!

                  Definitely! That guy is too smart.

                  Iain Clarke wrote:

                  ps, Noone's delivered your urgent drugs yet?

                  Nope my friend...But since you are such a nice guy, ...plz plz plz urgent!!! :-D

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                  C Offline
                  C Offline
                  Cedric Moonen
                  wrote on last edited by
                  #8

                  CPallini wrote:

                  Definitely! That guy is too smart.

                  Well, it seems that you really abuse drugs :rolleyes:

                  Cédric Moonen Software developer
                  Charting control [v1.4]

                  R 1 Reply Last reply
                  0
                  • C Cedric Moonen

                    CPallini wrote:

                    Definitely! That guy is too smart.

                    Well, it seems that you really abuse drugs :rolleyes:

                    Cédric Moonen Software developer
                    Charting control [v1.4]

                    R Offline
                    R Offline
                    Rajesh_Parameswaran
                    wrote on last edited by
                    #9

                    Hi Pallini and Iain, Thanks for your response. But I still have that error. Both the Characterset are set to the following: Character Set: Use Unicode Character Set Treat wchar_t as Built-in Type: No(/Zc:wchar_t-)\ thanks and regards, Rajesh

                    R CPalliniC 2 Replies Last reply
                    0
                    • R Rajesh_Parameswaran

                      Hi Pallini and Iain, Thanks for your response. But I still have that error. Both the Characterset are set to the following: Character Set: Use Unicode Character Set Treat wchar_t as Built-in Type: No(/Zc:wchar_t-)\ thanks and regards, Rajesh

                      R Offline
                      R Offline
                      Rajkumar R
                      wrote on last edited by
                      #10

                      sorry for the silly question, did you linked to the import library.

                      R 1 Reply Last reply
                      0
                      • R Rajesh_Parameswaran

                        Hi Pallini and Iain, Thanks for your response. But I still have that error. Both the Characterset are set to the following: Character Set: Use Unicode Character Set Treat wchar_t as Built-in Type: No(/Zc:wchar_t-)\ thanks and regards, Rajesh

                        CPalliniC Offline
                        CPalliniC Offline
                        CPallini
                        wrote on last edited by
                        #11

                        Rajesh_Parameswaran wrote:

                        Hi Pallini and Iain,

                        Since it is a reply to a Cedric post, I assume you're looking for the widest audience. :laugh:

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                        In testa che avete, signor di Ceprano?

                        R 1 Reply Last reply
                        0
                        • R Rajkumar R

                          sorry for the silly question, did you linked to the import library.

                          R Offline
                          R Offline
                          Rajesh_Parameswaran
                          wrote on last edited by
                          #12

                          Yes Rajkumar, I have linked to the import library. thanks in advance, regards, Rajesh

                          R 1 Reply Last reply
                          0
                          • R Rajesh_Parameswaran

                            Hi all, I'm using Visual Studio 2005. I have a workspace in visual C++ 6.0 which provides a set of library functions[DLL]. I have a client application which uses one of the function in the library. This client was working perfectly in VC6.0, but when I ported to VC8, it started showing link error: Signature of the Function in the library[DLL] Header: ULONG sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId); Implementation of the Function in the library[DLL] Source: ULONG NIHAI_TAPI::sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId) { .... .... .... } Client Application Call: TCHAR messageParameters[MESSAGES_PARAMS][MESSAGE_SIZE]; ULONG netCallId; bool request; returnCode = tapiConnection.sendInfo(request, messageParameters, netCallId); But I'm getting a link error: nihai_worker.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall NIHAI_TAPI::sendInfo(bool,unsigned short (* const)[81],unsigned long)" (__imp_?sendInfo@NIHAI_TAPI@@QAEK_NQAY0FB@GK@Z) referenced in function "private: unsigned long __thiscall NIHAI_Worker::sendToTAPI(unsigned int,unsigned short (* const)[81],unsigned long)" (?sendToTAPI@NIHAI_Worker@@AAEKIQAY0FB@GK@Z) Kindly suggest a resolution for the above problem. Thanks in Advance. regards, Rajesh

                            I Offline
                            I Offline
                            Iain Clarke Warrior Programmer
                            wrote on last edited by
                            #13

                            Coming back your original question, go back to basics. Write a function such as:

                            int HowBigIsATCHAR (TCHAR i_is_a_letter)
                            {
                            return sizeof (i_is_a_letter);
                            }

                            not forgetting to use dllimport / export. Try using it in a your client program. See if you get link errors, and also what size it gives you. The TCHAR thing may be a blind alley, and you are having linking trouble with constant sizeed arrays. I've never passed a big array be value before... Try passing it as TCHAR **, and see if that helps? Iain.

                            Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.

                            1 Reply Last reply
                            0
                            • R Rajesh_Parameswaran

                              Yes Rajkumar, I have linked to the import library. thanks in advance, regards, Rajesh

                              R Offline
                              R Offline
                              Rajkumar R
                              wrote on last edited by
                              #14

                              you may inspect the import library for the symbol may be this( [libexplorer addin^], [libdump^]) tools helps or by simply open in binary editor. But basically these meant the symbol are not properly created in the import library, possibly check dllexport declarator is used for the class in the DLL class declaration.

                              1 Reply Last reply
                              0
                              • CPalliniC CPallini

                                Rajesh_Parameswaran wrote:

                                Hi Pallini and Iain,

                                Since it is a reply to a Cedric post, I assume you're looking for the widest audience. :laugh:

                                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                                R Offline
                                R Offline
                                Rajkumar R
                                wrote on last edited by
                                #15

                                Actually i saw that was replied to you, but when OP had seen world is behind "Plz sir slow down", he moved it there. :)

                                CPalliniC 1 Reply Last reply
                                0
                                • R Rajkumar R

                                  Actually i saw that was replied to you, but when OP had seen world is behind "Plz sir slow down", he moved it there. :)

                                  CPalliniC Offline
                                  CPalliniC Offline
                                  CPallini
                                  wrote on last edited by
                                  #16

                                  Possibly. :-D

                                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                                  In testa che avete, signor di Ceprano?

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups