Skip to content

Commit

Permalink
windows: Export/import library symbols for linking
Browse files Browse the repository at this point in the history
Without this, gstawscredentials-1.0.lib is not generated by LINK.exe
because no symbols are exported, and compilation fails.

We can simply use the symbols exported by gstreamer in gst/gstconfig.h
to do this correctly.

Related to #13
  • Loading branch information
nirbheek authored and loganek committed Jan 21, 2022
1 parent b2372f8 commit 8aa7cde
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/gstawscredentials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
#include "gstawscredentials.hpp"

#include <gst/gst.h>

#include <aws/core/auth/AWSCredentialsProviderChain.h>
#include <aws/sts/model/AssumeRoleRequest.h>
#include <aws/sts/STSClient.h>
Expand Down
6 changes: 5 additions & 1 deletion src/gstawscredentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@
#ifndef __GST_AWS_CREDENTIALS_H__
#define __GST_AWS_CREDENTIALS_H__

#include <glib-object.h>
#include <gst/gst.h>

G_BEGIN_DECLS

typedef struct _GstAWSCredentials GstAWSCredentials;

GST_EXPORT
GstAWSCredentials * gst_aws_credentials_new_default (void);

GST_EXPORT
GstAWSCredentials * gst_aws_credentials_copy (GstAWSCredentials * credentials);

GST_EXPORT
void gst_aws_credentials_free (GstAWSCredentials * credentials);

GST_EXPORT
GType gst_aws_credentials_get_type (void);

#define GST_TYPE_AWS_CREDENTIALS \
Expand Down
2 changes: 2 additions & 0 deletions src/gstawscredentials.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@

using GstAWSCredentialsProviderFactory = std::function<std::unique_ptr<Aws::Auth::AWSCredentialsProvider>()>;

GST_EXPORT
GstAWSCredentials *
gst_aws_credentials_new (GstAWSCredentialsProviderFactory factory);

GST_EXPORT
std::unique_ptr<Aws::Auth::AWSCredentialsProvider>
gst_aws_credentials_create_provider (GstAWSCredentials * credentials);

Expand Down
1 change: 1 addition & 0 deletions src/gsts3sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct _GstS3SinkClass {
GstBaseSinkClass parent_class;
};

GST_EXPORT
GType gst_s3_sink_get_type (void);

G_END_DECLS
Expand Down
7 changes: 7 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ gst_s3_public_headers = [
'gstawscredentials.hpp'
]

# Export symbols when building, import when not. This is optional on Linux
# / macOS, but necessary on Windows otherwise .lib files will not be generated.
symbol_export_define = ['-DGST_EXPORTS']

credentials = library('gstawscredentials-@0@'.format(apiversion),
['gstawscredentials.cpp'],
dependencies : [aws_cpp_sdk_sts_dep, gst_dep],
cpp_args: symbol_export_define,
install : true
)

Expand All @@ -30,6 +35,8 @@ multipart_uploader_dep = declare_dependency(link_with : multipart_uploader,

gst_s3_elements = library('gsts3elements',
gst_s3_elements_sources,
cpp_args: symbol_export_define,
c_args: symbol_export_define,
dependencies : [gst_dep, gst_base_dep, multipart_uploader_dep, credentials_dep],
include_directories : [configinc],
install : true,
Expand Down

0 comments on commit 8aa7cde

Please sign in to comment.