You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please add a switch to indicate whether to generate function pointer declarations.
If you think it is optional, you can add a switch to indicate whether to generate it.
Now, only function declarations of the form
intfoo(inta, intb);
can be generated from the cbindgen tool, but no function pointer declarations of the form
int (*pfn_foo)(inta, intb);
can be generated.
This makes it very inconvenient when we dynamically load the dll library generated by rust.
I hope you will consider this request.
For example,
#include<windows.h>#include<stdio.h>// define a function pointer type by ourselvestypedefint (*pfn_foo)(int, int);
intmain() {
HMODULEhModule=LoadLibrary("a.dll");
if (hModule==NULL) {
return1;
}
pfn_foofoo= (pfn_foo)GetProcAddress(hModule, "foo");
if (foo==NULL) {
FreeLibrary(hModule);
return1;
}
intresult=foo(5, 10);
printf("result: %d\n", result);
FreeLibrary(hModule);
return0;
}
The text was updated successfully, but these errors were encountered:
ssrlive
changed the title
Please add a switch to indicate whether to generate function pointer declarations.
[Feature Request] Please add a switch to indicate whether to generate function pointer declarations.
Oct 22, 2024
Please add a switch to indicate whether to generate function pointer declarations.
If you think it is optional, you can add a switch to indicate whether to generate it.
Now, only function declarations of the form
can be generated from the
cbindgen
tool, but no function pointer declarations of the formcan be generated.
This makes it very inconvenient when we dynamically load the dll library generated by rust.
I hope you will consider this request.
For example,
The text was updated successfully, but these errors were encountered: