Skip to content

[go] Fix argument type of pulsarProducerSendCallbackProxy #8186

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

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

massakam
Copy link
Contributor

@massakam massakam commented Oct 2, 2020

Motivation

When installing or running Pulsar CGo client, we get the following warning:

../go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20201001145619-e65875b99e39/pulsar/c_go_pulsar.h: In function '_pulsar_producer_send_async':
../go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20201001145619-e65875b99e39/pulsar/c_go_pulsar.h:70:5: warning: passing argument 3 of 'pulsar_producer_send_async' from incompatible pointer type [-Wincompatible-pointer-types]
     pulsar_producer_send_async(producer, message, pulsarProducerSendCallbackProxy, ctx);
     ^

However, we can produce messages successfully.

Modifications

The second argument of the callback function pulsar_send_callback must be pulsar_message_id_t, not pulsar_message_t.

PULSAR_PUBLIC void pulsar_producer_send_async(pulsar_producer_t *producer, pulsar_message_t *msg,
pulsar_send_callback callback, void *ctx);

typedef void (*pulsar_send_callback)(pulsar_result, pulsar_message_id_t *msgId, void *ctx);

@massakam massakam added type/bug The PR fixed a bug or issue reported a bug component/go release/2.6.2 labels Oct 2, 2020
@massakam massakam added this to the 2.7.0 milestone Oct 2, 2020
@massakam massakam self-assigned this Oct 2, 2020
@sijie sijie merged commit b1dfd42 into apache:master Oct 5, 2020
@massakam massakam deleted the fix-cgo-send-callback branch October 6, 2020 01:52
wolfstudy pushed a commit that referenced this pull request Oct 30, 2020
### Motivation

When installing or running Pulsar CGo client, we get the following warning:
```
../go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20201001145619-e65875b99e39/pulsar/c_go_pulsar.h: In function '_pulsar_producer_send_async':
../go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20201001145619-e65875b99e39/pulsar/c_go_pulsar.h:70:5: warning: passing argument 3 of 'pulsar_producer_send_async' from incompatible pointer type [-Wincompatible-pointer-types]
     pulsar_producer_send_async(producer, message, pulsarProducerSendCallbackProxy, ctx);
     ^
```
However, we can produce messages successfully.

### Modifications

The second argument of the callback function `pulsar_send_callback` must be `pulsar_message_id_t`, not `pulsar_message_t`.
https://github.com/apache/pulsar/blob/be6a102511560349701dbe6b83fabf831dc81340/pulsar-client-cpp/include/pulsar/c/producer.h#L80-L81
https://github.com/apache/pulsar/blob/be6a102511560349701dbe6b83fabf831dc81340/pulsar-client-cpp/include/pulsar/c/producer.h#L34

(cherry picked from commit b1dfd42)
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Nov 13, 2020
### Motivation

When installing or running Pulsar CGo client, we get the following warning:
```
../go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20201001145619-e65875b99e39/pulsar/c_go_pulsar.h: In function '_pulsar_producer_send_async':
../go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20201001145619-e65875b99e39/pulsar/c_go_pulsar.h:70:5: warning: passing argument 3 of 'pulsar_producer_send_async' from incompatible pointer type [-Wincompatible-pointer-types]
     pulsar_producer_send_async(producer, message, pulsarProducerSendCallbackProxy, ctx);
     ^
```
However, we can produce messages successfully.

### Modifications

The second argument of the callback function `pulsar_send_callback` must be `pulsar_message_id_t`, not `pulsar_message_t`.
https://github.com/apache/pulsar/blob/be6a102511560349701dbe6b83fabf831dc81340/pulsar-client-cpp/include/pulsar/c/producer.h#L80-L81
https://github.com/apache/pulsar/blob/be6a102511560349701dbe6b83fabf831dc81340/pulsar-client-cpp/include/pulsar/c/producer.h#L34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/2.6.2 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants