473,503 Members | 3,722 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<LibraryNamespace::LibraryObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference the
list<LibraryNamespace::LibraryObjectconstructor. Note that the Library is
unmanaged code.
Dec 30 '06 #1
5 1378
>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<LibraryNamespace::LibraryObjectmyList;
....
}
};
}

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

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.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<LibraryNamespace::LibraryObjectmyList;
....
}
};
}

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

Could you please post the complete compiler error message?

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.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::Coordinate,class std::allocator<class
Magick::Coordinate::push_back(class Magick::Coordinate const &)"
(?push_back@?$list@VCoordinate@Magick@@V?$allocato r@VCoordinate@Magick@@@std@@@std@@$$FQAEXABVCoordi nate@Magick@@@Z) NETMagick.obj

error LNK2001: unresolved external symbol "public: __thiscall
std::list<class Magick::Coordinate,class std::allocator<class
Magick::Coordinate::list<class Magick::Coordinate,class
std::allocator<class Magick::Coordinate(void)"
(??0?$list@VCoordinate@Magick@@V?$allocator@VCoord inate@Magick@@@std@@@std@@$$FQAE@XZ) NETMagick.obj

and the code causing it....

public ref class IMDrawableBezier : public
IMDrawable<Magick::DrawableBezier{
public:
IMDrawableBezier(System::Collections::Generic::ILi st<IMCoordinate^>%
coordinateList) {
std::list<Magick::Coordinatelst;
for each (IMCoordinate^ point in coordinateList) {
lst.push_back(::Magick::Coordinate(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<LibraryNamespace::LibraryObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference
the list<LibraryNamespace::LibraryObjectconstructor. 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<LibraryNamespace::LibraryObjectmyList;
....
}
};
}

What occurs is I end up with a link 2001 error, trying to reference
the list<LibraryNamespace::LibraryObjectconstructor. 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(dllexport),
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
5927
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";...
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...
4
1802
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...
7
2021
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!=():...
43
13210
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...
8
1728
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
5021
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
16068
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...
25
1985
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...
0
7192
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,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
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...
0
7445
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...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4991
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...
0
3158
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...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
369
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...

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.