473,657 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inline funtions (STL) not inlining

I asked about this a few days ago, and not found an aswer yet, but I have
tracked down further info. I am getting the problems occrrung with the stl,
under thses sorts of circumstances:

#include "LibraryHeader. h"
#include <list>

namespace MyNamespace {
public ref MyClass {
public:
MyMethod() {
list<LibraryNam espace::Library ObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference the
list<LibraryNam espace::Library Objectconstruct or. Note that the Library is
unmanaged code.
Dec 30 '06 #1
5 1383
>I asked about this a few days ago, and not found an aswer yet, but I have
tracked down further info. I am getting the problems occrrung with the
stl,
under thses sorts of circumstances:

#include "LibraryHeader. h"
#include <list>

namespace MyNamespace {
public ref MyClass {
public:
MyMethod() {
list<LibraryNam espace::Library ObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference the
list<LibraryNam espace::Library Objectconstruct or. Note that the Library
is
unmanaged code.
Could you please post the complete compiler error message?

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
Dec 30 '06 #2


"Bruno van Dooren [MVP VC++]" wrote:
I asked about this a few days ago, and not found an aswer yet, but I have
tracked down further info. I am getting the problems occrrung with the
stl,
under thses sorts of circumstances:

#include "LibraryHeader. h"
#include <list>

namespace MyNamespace {
public ref MyClass {
public:
MyMethod() {
list<LibraryNam espace::Library ObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference the
list<LibraryNam espace::Library Objectconstruct or. Note that the Library
is
unmanaged code.

Could you please post the complete compiler error message?

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
ok: I am trying to wrap the ImageMagick library at the moment: Here is a
paste of the message (with the real function names)

error LNK2001: unresolved external symbol "public: void __thiscall
std::list<class Magick::Coordin ate,class std::allocator< class
Magick::Coordin ate::push_back( class Magick::Coordin ate const &)"
(?push_back@?$l ist@VCoordinate @Magick@@V?$all ocator@VCoordin ate@Magick@@@st d@@@std@@$$FQAE XABVCoordinate@ Magick@@@Z) NETMagick.obj

error LNK2001: unresolved external symbol "public: __thiscall
std::list<class Magick::Coordin ate,class std::allocator< class
Magick::Coordin ate::list<class Magick::Coordin ate,class
std::allocator< class Magick::Coordin ate(void)"
(??0?$list@VCoo rdinate@Magick@ @V?$allocator@V Coordinate@Magi ck@@@std@@@std@ @$$FQAE@XZ) NETMagick.obj

and the code causing it....

public ref class IMDrawableBezie r : public
IMDrawable<Magi ck::DrawableBez ier{
public:
IMDrawableBezie r(System::Colle ctions::Generic ::IList<IMCoord inate^>%
coordinateList) {
std::list<Magic k::Coordinatels t;
for each (IMCoordinate^ point in coordinateList) {
lst.push_back(: :Magick::Coordi nate(point->X, point->Y));
}
pDraw = new CLASS(lst);
}
};

Dec 30 '06 #3
Mick O''Neill wrote:
I asked about this a few days ago, and not found an aswer yet, but I
have tracked down further info. I am getting the problems occrrung
with the stl, under thses sorts of circumstances:

#include "LibraryHeader. h"
#include <list>

namespace MyNamespace {
public ref MyClass {
public:
MyMethod() {
list<LibraryNam espace::Library ObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference
the list<LibraryNam espace::Library Objectconstruct or. Note that the
Library is unmanaged code.
Does "LibraryHeader. h" contain a #pragma managed directive?

If not, you're probably ending up with an ODR violation with LibraryObject
being defined as both a CLR class and a native class - that could be the
source of your error. You might try:

#pragma managed (push, off)
#include "LibraryHeader. h"
#include <list>
#pragma managed (pop)

to see if that resolves the error.

-cd
Dec 30 '06 #4


"Carl Daniel [VC++ MVP]" wrote:
Mick O''Neill wrote:
I asked about this a few days ago, and not found an aswer yet, but I
have tracked down further info. I am getting the problems occrrung
with the stl, under thses sorts of circumstances:

#include "LibraryHeader. h"
#include <list>

namespace MyNamespace {
public ref MyClass {
public:
MyMethod() {
list<LibraryNam espace::Library ObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference
the list<LibraryNam espace::Library Objectconstruct or. Note that the
Library is unmanaged code.

Does "LibraryHeader. h" contain a #pragma managed directive?

If not, you're probably ending up with an ODR violation with LibraryObject
being defined as both a CLR class and a native class - that could be the
source of your error. You might try:

#pragma managed (push, off)
#include "LibraryHeader. h"
#include <list>
#pragma managed (pop)

to see if that resolves the error.

-cd
Thanks Carl - something I hadn't thought of. However, just tried it, and
made no difference. I'll keep trying to find a work around. Maybe something
will click.

Mick

Dec 30 '06 #5
Hey everyone - I've figured it out. It has to do with the way the ImageMagick
headers builds the libraries and/or DLL's. Because I'm wrapping the whole
thing in a .NET assembly, but linking to the static ImageMagick libraries,
the Headers are getting confused, and thinking the assembly is a DLL build of
the library, and prefixing the declarations with a __declspec(dlle xport),
effectively stopping the inlining.

Now I've figured out the "why", should be simple enough to stop it all.

Thanks for your help folks.

Dec 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
5979
by: qazmlp | last post by:
My class in a header file, contains inline virtual destructor. Is this Ok? Can it cause any problems? class base { public: base() { } virtual ~base { std::cout<<"Inside virtual destructor\n"; } // Other members
21
746
by: Rubén Campos | last post by:
I haven't found any previous message related to what I'm going to ask here, but accept my anticipated excuses if I'm wrong. I want to ask about the real usefulness of the 'inline' keyword. I've read many authors (and it's my belief, too) who discourage the use of the 'inline' keyword, because: - The 'inline' word only advice the compiler about wich functions should be expanded, but not force it to expand them. Also, the compiler can...
4
1814
by: Tony Johansson | last post by:
Hello experts! I'm reading a book about C++ and there is something about inline that the book says that is unclear for me. The book says the following "Because inline functions are expanded at compile time, definitions of these functions, unlike other definitions, cannot be separately compiled and must be placed in header files. This creates a problem if the compiler does not actually inline a
7
2028
by: Alvin | last post by:
Hello all, I'm curious as to your opinions on explicitly inlining function? I'm talking about functions as members of a class. For example, so class A defines a operator==() and a operator!=(): class_a.h: class A {
43
13271
by: Patrick Laurent | last post by:
Hello I have a program with many many inlined template functions It is essential for the execution speed that every (or almost every) function marked as inlined, becomes really inlined by the compiler. I already compiled the program with Intel Compiler (ICL) on Visual C++, and it works fine and fast. I verified that the functions are really inlined. But with GCC 3.4 (Linux+Cygwin) or ICC (Linux), The same program is about 5
8
1740
by: John Ratliff | last post by:
Can the compiler ever inline a method when there is a pointer to the member used? Thanks, --John Ratliff
18
5051
by: Method Man | last post by:
If I don't care about the size of my executable or compile time, is there any reason why I wouldn't want to inline every function in my code to make the program run more efficient?
7
16100
by: Wu Shaohua | last post by:
Hi Guys, 1. As we know usually we should not define a constructor as inline. I also learned if we define a member function inside the class this member function will be automatically be inline'ed. My question is: If I define a constructor (including its body) or another large member function inside the class, the constructor or the member function is inline or not? why? 2. I learned that if the member function is big we should not...
25
2014
by: toton | last post by:
Hi, As inline is not mandetory, it depends on compiler to inline certain function (or using switch like fior GCC), my question is there any scope for inlining when it is not declared as inline function? i.e compiler may choose not to inline certain inline function, but is it free to choose a non inline function to inline it? I have some simple one line get function, and index operators which I want to get inlined. But due to some problem...
0
8394
marktang
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...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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,...
0
8605
tracyyun
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...
1
6164
isladogs
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...
0
5632
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();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.