Hello Newsgroup,
I have a link error that I did not manage to fix.
I basically consume a VC 8.0 C++ dll that exports a class with a
method containing CString declaration as follows:
class WarnErr
{
//...
CString WarnErr::getRea dableCode (long nCode)
{
//...
}
When using the method in another project (C++/CLI) to write a RTCW,
the linker fails with the following error:
Error 2 error LNK2028: unresolved token (0A00000F) "public: static
class ATL::CStringT<c har,class StrTraitMFC_DLL <char,class
ATL::ChTraitsCR T<char __cdecl
lala_McsOOP::Wa rnErr::getReada bleCode(long)" (?
getReadableCode @WarnErr@lala_M csOOP@@$$FSA?AV ?$CStringT@DV?
$StrTraitMFC_DL L@DV?$ChTraitsC RT@D@ATL@@@@@AT L@@J@Z) referenced in
function "public: class System::String ^ __clrcall
lala::Spectrome ter::RTCW::Spec trometerExcepti on::ToString(vo id)" (?
ToString@Spectr ometerException @RTCW@Spectrome ter@lala@@$$FQ$ AAMP
$AAVString@Syst em@@XZ) SpectrometerExc eption.obj
Does anybody know how to fix this issue. Or is there any other good
practice passing strings from unmanaged libs tto managed libs?
Thanks for your help! 4 5608
When using the method in another project (C++/CLI) to write a RTCW,
the linker fails with the following error:
Error 2 error LNK2028: unresolved token (0A00000F) "public: static
class ATL::CStringT<c har,class StrTraitMFC_DLL <char,class
ATL::ChTraitsCR T<char __cdecl
lala_McsOOP::Wa rnErr::getReada bleCode(long)" (?
getReadableCode @WarnErr@lala_M csOOP@@$$FSA?AV ?$CStringT@DV?
$StrTraitMFC_DL L@DV?$ChTraitsC RT@D@ATL@@@@@AT L@@J@Z) referenced in
function "public: class System::String ^ __clrcall
lala::Spectrome ter::RTCW::Spec trometerExcepti on::ToString(vo id)" (?
ToString@Spectr ometerException @RTCW@Spectrome ter@lala@@$$FQ$ AAMP
$AAVString@Syst em@@XZ) SpectrometerExc eption.obj
Does anybody know how to fix this issue. Or is there any other good
practice passing strings from unmanaged libs tto managed libs?
I suggest that the only things you should pass across module boundaries are:
(1) blocks of raw data (pointer and length)
(2) interface pointers
DCOM shows that by following these two rules you can have very powerful yet
stable interaction between all kinds of different components. Decoupling in
this way is also good for encapsulation, testability, and stability.
Trying to share class objects between unmanaged modules usually fails due to
ODR violations.
>
Thanks for your help!
On Jun 1, 9:14 pm, "Ben Voigt [C++ MVP]" <r...@nospam.no spamwrote:
When using the method in another project (C++/CLI) to write a RTCW,
the linker fails with the following error:
Error 2 error LNK2028: unresolved token (0A00000F) "public: static
class ATL::CStringT<c har,class StrTraitMFC_DLL <char,class
ATL::ChTraitsCR T<char __cdecl
lala_McsOOP::Wa rnErr::getReada bleCode(long)" (?
getReadableCode @WarnErr@lala_M csOOP@@$$FSA?AV ?$CStringT@DV?
$StrTraitMFC_DL L@DV?$ChTraitsC RT@D@ATL@@@@@AT L@@J@Z) referenced in
function "public: class System::String ^ __clrcall
lala::Spectrome ter::RTCW::Spec trometerExcepti on::ToString(vo id)" (?
ToString@Spectr ometerException @RTCW@Spectrome ter@lala@@$$FQ$ AAMP
$AAVString@Syst em@@XZ) SpectrometerExc eption.obj
Does anybody know how to fix this issue. Or is there any other good
practice passing strings from unmanaged libs tto managed libs?
I suggest that the only things you should pass across module boundaries are:
(1) blocks of raw data (pointer and length)
(2) interface pointers
DCOM shows that by following these two rules you can have very powerful yet
stable interaction between all kinds of different components. Decoupling in
this way is also good for encapsulation, testability, and stability.
Trying to share class objects between unmanaged modules usually fails due to
ODR violations.
Thanks for your help!
Hello Ben,
thanks for your comment on this issue. I generally agree with your
opinion as it is good practice.
However, there a couple of good reasons for CString as well and I was
under the opinion that passing basic types like strings isn't a big
deal anymore.
Let us consider the lib I'm trying to incorporate with is sort of fix
and will only get subject for changes if any other approach fails.
Can you point me to pretty good practices of passing strings of
individual length's from unmanaged code to C++/CLI code?
Thanks again,
Sebastian Dau
Does anybody know how to fix this issue. Or is there any other good
practice passing strings from unmanaged libs tto managed libs?
I suggest that the only things you should pass across module boundaries are: (1) blocks of raw data (pointer and length) (2) interface pointers DCOM shows that by following these two rules you can have very powerful yet stable interaction between all kinds of different components. Decoupling in this way is also good for encapsulation, testability, and stability.
Trying to share class objects between unmanaged modules usually fails due to ODR violations.
Thanks for your help!
Hello Ben,
thanks for your comment on this issue. I generally agree with your
opinion as it is good practice.
However, there a couple of good reasons for CString as well and I was
under the opinion that passing basic types like strings isn't a big
deal anymore.
Let us consider the lib I'm trying to incorporate with is sort of fix
and will only get subject for changes if any other approach fails.
Can you point me to pretty good practices of passing strings of
individual length's from unmanaged code to C++/CLI code?
First up, you must compile all code using the unmanaged DLL's classes
without /clr and with the same compiler version used by the DLL. Otherwise
the ODR is violated. This is not a recommendation, it is an absolute
requirement to get any sort of reasonable behavior.
Next, you should use fundamental types such as wchar_t* or char* to pass
data between those files compiled without /clr and the ones compiled with.
The definition of those types aren't changed by /clr or the compiler
version. These convert to and from the std::string and CString variants in
the usual way.
Then, use the following functions to get the data to/from .NET
System::String:
PtrToStringChar s
System::Runtime ::InteropServic es::Marshal::Pt rToString{Ansi| Auto|BSTR|Uni}
If you do that, everything should link and run without problems. If the DLL
was compiled using an earlier version of the compiler, then the static lib
wrappers described in "First up" should use extern "C" functions. You
should probably do that anyway.
>
Thanks again,
Sebastian Dau
On Jun 4, 3:30 pm, "Ben Voigt [C++ MVP]" <r...@nospam.no spamwrote:
Does anybody know how to fix this issue. Or is there any other good
practice passing strings from unmanaged libs tto managed libs?
I suggest that the only things you should pass across module boundaries
are:
(1) blocks of raw data (pointer and length)
(2) interface pointers
DCOM shows that by following these two rules you can have very powerful
yet
stable interaction between all kinds of different components. Decoupling
in
this way is also good for encapsulation, testability, and stability.
Trying to share class objects between unmanaged modules usually fails due
to
ODR violations.
Thanks for your help!
Hello Ben,
thanks for your comment on this issue. I generally agree with your
opinion as it is good practice.
However, there a couple of good reasons for CString as well and I was
under the opinion that passing basic types like strings isn't a big
deal anymore.
Let us consider the lib I'm trying to incorporate with is sort of fix
and will only get subject for changes if any other approach fails.
Can you point me to pretty good practices of passing strings of
individual length's from unmanaged code to C++/CLI code?
First up, you must compile all code using the unmanaged DLL's classes
without /clr and with the same compiler version used by the DLL. Otherwise
the ODR is violated. This is not a recommendation, it is an absolute
requirement to get any sort of reasonable behavior.
Next, you should use fundamental types such as wchar_t* or char* to pass
data between those files compiled without /clr and the ones compiled with.
The definition of those types aren't changed by /clr or the compiler
version. These convert to and from the std::string and CString variants in
the usual way.
Then, use the following functions to get the data to/from .NET
System::String:
PtrToStringChar s
System::Runtime ::InteropServic es::Marshal::Pt rToString{Ansi| Auto|BSTR|Uni}
If you do that, everything should link and run without problems. If the DLL
was compiled using an earlier version of the compiler, then the static lib
wrappers described in "First up" should use extern "C" functions. You
should probably do that anyway.
Thanks again,
Sebastian Dau
Thanks, Ben I'll give that a try and see how it works. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andy |
last post by:
I'm trying to make a Config-class that has only one instance, as the code
below states. However, when I try to use the instance with
CConfig::GetInstance() in another .cpp-file I get a link error:
StaticTest error LNK2001: unresolved external symbol "private: static class
CConfig CConfig::m_instance" (?m_instance@CConfig@@0V1@A)
Why is this?
//Config.h
|
by: vsaraog |
last post by:
Hi y'all,
I am using a Created Global Temporary Table in DB2 OS/390 version
7.1.2. I am inserting some data in it and then updating the table using
ODBC but while I try to update it, I am getting following message.
SQL0526N The requested function does not apply to declared temporary
tables. SQLSTATE=42995
Anyone has any ideas why I getting the above error message. Following
|
by: Leith Bade |
last post by:
I have been trying to use the new Visual C++ Toolkit 2003 with the VC6 IDE
I set up the executable, inlcude, and library directories to point to the new compilers
I had to fix a few errors in the MFC6 <afxtempl.h> to get it to compile with the better standards confomance (mainly omitted typename, and lazyness with specialized templates - using BASE_CLASS & TYPE instead of CObList & CObList*)
Now I get some strange linker errors, and I don't...
|
by: ashmangat |
last post by:
Hi!
now on the chapter "string-class" My assignment is below Word Counter:
Write a function that accepts a pointer to a C-String as an argument
and returns the number of words contained in the string. For instance,
if the string argument is "Four score and seven years ago" the function
should return the number 6. Demonstrate the function in a program that
asks the user to input a string and then passes it to the function. The
number of...
|
by: Bernie Hunt |
last post by:
I'm not sure where to ask this question so I'll start here. I have an app
with an installer program that has been delivered before. The user wanted a
change, so I made it and rebuilt the installer. The resulting install files
fail about 3/4 the way through the install and give an error of 2029. The
install then uninstalls and ends with a failure.
I don't know much about installer and I'm striking out finding any
information. Where can I...
| |
by: flyingxu |
last post by:
Hi,
I run into a cstring related link problem in VC7.
My solution has 3 projects, one MFC exe, two MFC extersion DLL.
the two MFC extersion DLL export functions which use CString as
parameters.
Everything is fine in VC6.
Now I want to upgrade the solution to VC7, but I got lots of link error
like this,
/*
WinGPC5.obj : error LNK2019: unresolved external symbol "public: static
|
by: adsci |
last post by:
Hello!
Im posting this to c.l.c++ AND win32 because i dont know if this is a MS
Compiler Issue or not.
here we go:
<code>
class MyCString
|
by: =?Utf-8?B?REx1ZWNr?= |
last post by:
I am getting a debug assertion error that reads:
Debug Assertion Failed!
program E:\program files\internet explorer\iexplore,exe
File: dbgheap.c
Line: 1252
Expression: _CrtIsValidHeapPointer(pUserData)
|
by: beauwlf |
last post by:
Hi Group
I am testing out Visual Studio 2008 Eval..
i tried to recompile my MFC C++ Visual Studio 6.0 EXE project . I get these
link errors.
I can say these errors are linked to EXE function calls to MFC DLL with
CString as parameter.
Error 383 error LNK2019: unresolved external symbol "__declspec(dllimport)
public: void __thiscall CViDlgModLink::SetDataAText(int,int,class
ATL::CStringT<char,class StrTraitMFC_DLL<char,class...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |