Closed GoogleCodeExporter closed 8 years ago
Thinking about it some more, if the designer of the callback function wanted
efficiency in the first place, they would have used a pointer or const& to pass
by reference instead, so I guess it makes sense for JavaCPP to make callback
arguments by value behave like return by value in the case of function call,
for consistency.
So, I updated the Generator in a similar fashion to your patch, plus a couple
of other changes to support Cast and FunctionPointer as well. It works with the
test cast you provided, thanks for that, so I think it's good to ship, but let
me know if anything needs additional fixing, thanks!
Original comment by samuel.a...@gmail.com
on 26 May 2012 at 4:00
Attachments:
Thanks. Will test on Monday.
I have to say that I'm hugely impressed with the approach your library takes in
actually attempting to stay object oriented through the java c++ boundary,
everything else I looked at requires flattening to a c style interface.
As an aside I think there is a fair bit of scope for factor common code out in
the generator. It might be worth cresting a class for generating argument
handling code, creating a instance for each argument and invoking a before and
after method on each instance in turn. Also a symbol table class that can be
used to generate unique variable names.
If you're interested in these ideas I could elaborate more.
Original comment by richardc...@gmail.com
on 26 May 2012 at 7:57
Ok, I've included the changes in the latest release! I'll mark this as fixed,
but do let me know if for some reason it doesn't work, thank you.
Yes, I was amazed myself that nobody had thought of a similar approach before,
not even Microsoft, who well settled with C++/CLI.
Anyway, Generator could use some refactoring that's for sure. C++ isn't exactly
a very consistent language, so I just made up stuff as I needed it, but I also
did it to prove that a tool like this could actually be done. But I'm afraid we
need more than a simple refactoring. We need a better design to deal with all
the corner cases.
I am hoping that someone at Oracle/Sun or something takes interest in this at
some point to include something similar in Java SE, but who knows how long that
will take...
In any case, of course, please do let me know of your ideas! At the very least,
if we don't do it ourselves, someone else reading this page could show an
interest in pursuing them. Thanks!
Original comment by samuel.a...@gmail.com
on 27 May 2012 at 12:46
Samuel,
I have verified that version 0.1 fixes the problem.
thanks
Richard
Original comment by richardc...@gmail.com
on 28 May 2012 at 1:24
Great! BTW, do post your ideas and what not on the mailing list, or private
e-mail works fine too if that works for you. I would love to hear what you have
in mind, thanks!
Original comment by samuel.a...@gmail.com
on 28 May 2012 at 1:20
Original issue reported on code.google.com by
richardc...@gmail.com
on 23 May 2012 at 3:32Attachments: