🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.programmer.codewarrior
2 messages
2 total messages Started by Peter Teeson Wed, 08 Nov 2000 00:00
[Q] Mac equivalent of __declspec (dllimport)
#1339
Author: Peter Teeson
Date: Wed, 08 Nov 2000 00:00
28 lines
1507 bytes
Using Mac CW Pro 6 I'm porting some C++ from Windows and have run into 
something I don't understand. There are several pieces of code of the 
form:

template class _declspec (dllimport) Foo<sometype>;

for example

template class _declspec (dllimport) vector<float>;

Clearly this is a specialisation for float vectors.
However on the Mac this gives a compilation error

Error   : illegal use of incomplete struct/union/class ....

Removing the _declspec (dllimport) gets a clean compile.
I've looked up the __declspec(arg) and understand how it's used.

So what is the Mac equivalent of the dllimport argument?

TIA for your help


Peter

-- 
"Developing quality software requires a great deal of effort
over a long period of time." Doug Schmidt - C++ Report May 1996
Re: [Q] Mac equivalent of __declspec (dllimport)
#1340
Author: Tim Hosking
Date: Wed, 08 Nov 2000 00:00
59 lines
2881 bytes
in article pteeson-8AD390.12082008112000@news1.on.sympatico.ca, Peter Teeson
at pteeson@sympatico.ca wrote on 11/8/00 12:06 PM:

> Using Mac CW Pro 6 I'm porting some C++ from Windows and have run into
> something I don't understand. There are several pieces of code of the
> form:
> 
> template class _declspec (dllimport) Foo<sometype>;
> 
> for example
> 
> template class _declspec (dllimport) vector<float>;
> 
> Clearly this is a specialisation for float vectors.
> However on the Mac this gives a compilation error
> 
> Error   : illegal use of incomplete struct/union/class ....
> 
> Removing the _declspec (dllimport) gets a clean compile.
> I've looked up the __declspec(arg) and understand how it's used.
> 
> So what is the Mac equivalent of the dllimport argument?
> 
> TIA for your help
> 
> 
> Peter

#include <conditionalmacros.h>

In there you  will find the following: (sorry about the line-wrapping)

    #define EXTERN_API(_type)                        __declspec(dllimport)
_type __cdecl
    #define EXTERN_API_C(_type)                        __declspec(dllimport)
_type __cdecl
    #define EXTERN_API_STDCALL(_type)                __declspec(dllimport)
_type __stdcall
    #define EXTERN_API_C_STDCALL(_type)                __declspec(dllimport)
_type __stdcall
    #define CALLBACK_API(_type, _name)                _type (__cdecl *
_name)
    #define CALLBACK_API_C(_type, _name)            _type (__cdecl * _name)
    #define CALLBACK_API_STDCALL(_type, _name)        _type (__stdcall *
_name)
    #define CALLBACK_API_C_STDCALL(_type, _name)    _type (__stdcall *
_name)

when building for Windows.

These macros simply use 'extern' when building for the Mac platform. Check
in the Universal Interfaces for examples of their use.

ConditionalMacros.h should work just fine when building on a Windows
platform.

--
Tim Hosking
Before they invented drawing boards, what did they go back to?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads