Re: "definition of dllimport function not allowed" error
- From: "Julian" <julvar@xxxxxxxxxxxxxx>
- Date: Wed, 5 Apr 2006 17:57:08 -0500
"Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx> wrote in message
news:uPS%23$DKWGHA.3972@xxxxxxxxxxxxxxxxxxxxxxx
Julian wrote:
I am rebuilding my code (which was initially built using VC6 with no
errors) using .NET2005.
after fixing the code to get rid of the errors, I am still left with this
one.
I have simplified my code (see below) to reproduce the error:
error C2491: 'Array<T>::isIn' : definition of dllimport function not
allowed
I looked up the MSDN help files but it didn't help much. can someone tell
me what I need to do to fix this?
thanks,
Julian.
template <class T> class __declspec(dllimport) Array
I'm surprised that even compiles. It doesn't make any sense to mark a
class template (or function template) as __declspec(dllimport), since it
isn't real code, just a template for creating real code. As such, there's
nothing to import!
What you can do is import/export particular specializations of templates,
which do consist of real code. For example, this exports a particular
template instantiation (and must be in the .cpp file I think).
template class __declspec(dllexport) Array<int>;
To import, you want, in the header:
template class __declspec(dllimport) Array<int>;
after the definition of Array<T>.
Tom
I think I get what you mean... let me try it out and get back to you.
.
- Follow-Ups:
- References:
- "definition of dllimport function not allowed" error
- From: Julian
- Re: "definition of dllimport function not allowed" error
- From: Tom Widmer [VC++ MVP]
- "definition of dllimport function not allowed" error
- Prev by Date: Re: "definition of dllimport function not allowed" error
- Next by Date: Re: How does RC file store double-bytes chars ?
- Previous by thread: Re: "definition of dllimport function not allowed" error
- Next by thread: Re: "definition of dllimport function not allowed" error
- Index(es):
Relevant Pages
|