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

msgpack.dll doesn't export most of the functions #356

Closed
pi-jas opened this issue Aug 26, 2015 · 3 comments
Closed

msgpack.dll doesn't export most of the functions #356

pi-jas opened this issue Aug 26, 2015 · 3 comments

Comments

@pi-jas
Copy link

pi-jas commented Aug 26, 2015

I'm trying to create a version of msgpack.dll to include in a LabVIEW VI but there only appear to be 33 functions which are prefaced with the MSGPACK_DLLEXPORT keyword. This is my first time using a DLL, so my understanding may be flawed.

My question is two-fold;

  1. Am I doing something wrong?
  2. How can I access functions such as msgpack_sbuffer_init, msgpack_packer_init and any of the msgpack_pack_xxx functions without having to modify the msgpack source?

Regards, John

@redboltz
Copy link
Contributor

Hi @pi-jas,

  1. Am I doing something wrong?

No, you are doing well.

  1. How can I access functions such as msgpack_sbuffer_init, msgpack_packer_init and any of the msgpack_pack_xxx functions without having to modify the msgpack source?

Those functions are defined as inline function. See:
https://github.com/msgpack/msgpack-c/blob/master/include/msgpack/sbuffer.h#L41
https://github.com/msgpack/msgpack-c/blob/master/include/msgpack/pack.h#L131
https://github.com/msgpack/msgpack-c/blob/master/include/msgpack/pack.h#L116

When you include those header files, you can call those functions. That's why, those functions are not exported to DLL.

FYI: When you use MSVC, 'inline' is replaced to '__inline'.
https://github.com/msgpack/msgpack-c/blob/master/include/msgpack/sysdep.h#L192

@pi-jas
Copy link
Author

pi-jas commented Aug 26, 2015

Thanks for the quick reply @redboltz.
It would seem that my problems lie in importing the DLL to LabVIEW. I guess I'll need to manually create the references from within LabVIEW to use the inline functions.

@pi-jas
Copy link
Author

pi-jas commented Aug 27, 2015

Just in case anyone else encounters the same problem. I solve the LabVIEW problem by writing a C wrapper around the static __inline functions to export them.

__declspec(dllexport) void msgpack_sbuffer_init_ext(msgpack_sbuffer\* sbuf) { msgpack_sbuffer_init(sbuf); }

I created a companion header file as well for completeness.

@pi-jas pi-jas closed this as completed Aug 27, 2015
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

2 participants