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

<char*> & <c-string> #5

Open
iglennrogers opened this issue Apr 21, 2012 · 2 comments
Open

<char*> & <c-string> #5

iglennrogers opened this issue Apr 21, 2012 · 2 comments

Comments

@iglennrogers
Copy link
Contributor

Having a naked import:declaration, gives a line in the translation as :
define C-pointer-type <char*> => <C-signed-char>;
with <char*> used in function declarations. However, these are unable to be directly assigned to a <string>.

Having a line
equate: { "char *" => <c-string> }
allows an assignment to <string>, but gives the following error.

Serious warning at sqlib-base-ffi.dylan:12:

Attempt to define variable {<C-string> in c-ffi-interface} owned by another library, definition ignored.

sqlib-base-ffi.dylan:11: ---------------------------------------------------
sqlib-base-ffi.dylan:12: define C-pointer-type <c-string> => <C-signed-char>;
sqlib-base-ffi.dylan:13: ---------------------------------------------------

It might be worthwhile having the define C-pointer-type <char*> => <C-signed-char>; line in the cffi library in addition to the <c-string> definition (assuming that's where it is) (there must be other common substitutions as well), but then not writing anything into the dylan file, so the error isn't generated, especially if it's marked as 'serious'

@waywardmonkeys
Copy link
Member

What if you do:

  #include "whatever.h",
    equate: {"char *" => <c-string>},
    map: {"char *" => <byte-string>};

?

@iglennrogers
Copy link
Contributor Author

You still get define C-pointer-type <c-string> => <C-signed-char>; written into the file - this is incidentally just before it's first required.

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