Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to handle __declspec(dllimport) properly #5

Closed
mbechard opened this issue Feb 13, 2013 · 9 comments
Closed

fails to handle __declspec(dllimport) properly #5

mbechard opened this issue Feb 13, 2013 · 9 comments

Comments

@mbechard
Copy link

When trying to compile ffmpeg with --enable-shared, the conversion fails.

This can be traced to this define
define av_export __declspec(dllimport)

And for example in libavformat/asfenc.c

It fails due to this line getting included from riff.h
extern av_export const AVCodecTag ff_codec_bmp_tags[];

Which creates in the converted c89 file for asfenc.c
extern __declspec(dllimport) const AVCodecTag ff_codec_bmp_tags[];

causing this line to have a compile error (in asfenc.c)
static const AVCodecTag * const tmp__1[] = {
codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0
};

--> error C2099: Initializer is not a constant

Maybe this isn't fixable though? Not sure

@mstorsjo
Copy link
Contributor

This is not a converter issue but an issue with the code tree itself. Also, --enable-shared builds with libav do work just fine, see e.g. http://fate.libav.org/i686-msvc-10-dll-wine/20130212192512.

@rdp
Copy link

rdp commented Feb 14, 2013

I had thought that the purpose of av_export was to allow constants to be shared cross dll's with msvc builds, e.g. this line

libavcodec/mjpeg.h
141:extern av_export const uint8_t avpriv_mjpeg_bits_dc_luminance[];

(which seems to work line).

What's the difference here, anybody know, between that and this line?

libavformat/riff.h
54:extern av_export const AVCodecTag ff_codec_bmp_tags[];

which seems to fail? (I put the av_export in there thinking it would fix msvc builds...)

update: I guess ff_codec_bmp_tags is used differently than "most other shared constants" so will need special treatment... (hence it causing error C2099: Initializer is not a constant but others don't)

(@malbe
Could you try removing the av_export from riff.h and see if that fixes it? I think it won't be enough but worth testing...)

Thanks for your help to this confused developer.
-roger-

@mbechard
Copy link
Author

Yes when I removed av_export it works, and the .dlls still export the functions correctly so I guess that's done redundantly elsewhere via another mechanism. I just wanted to report it incase it was unexpected behavior.

@Nevcairiel
Copy link
Member

av_export is not needed when exporting a symbol, but actually when importing it. Its a bit misleading that way.

@rdp
Copy link

rdp commented Feb 14, 2013

Makes me wonder if av_export is needed at all these days...maybe the use of .v files makes them it needed these days?

@rbultje
Copy link
Contributor

rbultje commented Feb 14, 2013

I indeed don't think you need av_export ATM.

@Nevcairiel
Copy link
Member

You do need it when importing data from shared libraries in msvc, which is
why it was introduced.

@rbultje
Copy link
Contributor

rbultje commented Feb 14, 2013

We enforce that as a linker option instead, I believe?

@rdp
Copy link

rdp commented Feb 15, 2013

ok thanks for your help here, git master should compile now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants