Comments (2)
Can we also have support for pointer-of-pointer?
I'm wrapping kmod
and they have functions like this:
struct kmod_module;
int kmod_module_new_from_name(struct kmod_ctx *ctx, const char *name,
struct kmod_module **mod);
These can be roughly mapped to
proc kmod_module_new_from_name*(ctx: ptr kmod_ctx; name: cstring; `mod`: var ptr kmod_module): int {.importc, header: headerlibkmod.}
from nimterop.
This has been implemented in the latest commit.
Considering there's no way to know what the developer meant with char **
- could be array of cstring or pointer to a cstring, I'm just mapping everything to ptr ptr
, except ptr ptr cchar
which becomes ptr cstring
. This was one of Araq's examples of how you cannot always translate 100% automatically.
@alaviss - your case will become ptr ptr kmod_module
. This is how c2nim does it right now as well.
type
kmod_module* {.bycopy.} = object
proc kmod_module_new_from_name*(ctx: ptr kmod_ctx, name: cstring, `mod`: ptr ptr kmod_module): cint {.importc, header: headertest.}
Open to feedback.
from nimterop.
Related Issues (20)
- Structs mapped from C header need completeStruct pragma, otherwise sizeof doesn't work on those
- VM does not support 'cast' from tyFloat to tyFloat HOT 2
- [Question] Change build directory HOT 1
- Toast parsing comment as var HOT 4
- Inject code to process `#define`? HOT 8
- Building Failed with nimble. HOT 2
- [Question] Binding to OpenCV HOT 2
- Using nimterop in MSYS2 Bash environment on Windows HOT 3
- Header path handling on Windows HOT 3
- βuint16_t β What happened?
- Typedef function with an enum return type
- Support OpenBSD
- The nimterop good this reference documentation to convert small C project
- [Question] Nimterop, libnx and DevKitPro | sys/lock.h : No such file or directory HOT 1
- "cmd: not found" when building using mingw building a windows executable in linux
- ssing comma in the example
- Toast segfault with comment after define
- Build fails due to `macro getHeader` Implementation
- Documentation
- Both installation methods fail on Linux Mint 21.3 with Nim 1.6.12 and 2.0.4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nimterop.