Trying to come up for a name for my framework for making packages / handling dependencies. Currently it is just PackageFramework but I'm wondering if anyone has a spicier name.
@b3m2a1 I've never used swig before, but I have been thinking along these lines myself. I've hacked together my own system, where I precede a given c++ function with a comment styled in a particular way (similar to a doxygen comment I think, but again I've never used that system). Then when I build my paclet it scans the files for those comments and writes the C and WL wrapper functions.
The C-code generation is very much based on Szabolcs' LTemplate, but modified somewhat
Here is an example of the template, along with the C and WL code, pastebin.com/6DiqJh39
I also make heavy use of JSON, so that I can easily transfer data structures like Associations, ragged arrays, heterogeneous lists, etc, back and forth to c++
It's fairly easy to set it up with a new library, I had set up a link to the Ghent Quantum Chemistry Package but got distracted and haven't revisited it
frankly I haven't had much interest in this auto-library link approach, so I'm the only one to use it
I know I can use the Property interface for things like Graph but I want to use it for all of my objects. This includes:
SetProperty
PropertyValue
PropertyList
RemoveProperty
Can I define it in some efficient, non-memory-leaky way for any object I want?
@b3m2a1 any time you want to send information to the library that isn't one of the pre-defined data types. You can a list of integers just fine, but what about a list of strings? You certainly can't send an association to the library and access the values by their keys.
for arrays of a known type you use the normal library link passing
but for something as simple as passing a list of strings to the library, you could either use MathLink to call back and get the data, or serialize it to a json string, pass it as a single UTF8String, then deserialize in the library
Using json is so easy I was getting lazy and using it basically as an OptionValue on the library side
like the function to generate 3D coordinates for a molecule, on the c++ side the function takes so many parameters there is a struct for all the options. To create that struct before calling the function I was just passing an Association via JSON, rather than creating a function with ~12 arguments
but this is adding some (small) overhead, and so I'm now going through and reversing that
the overhead is small though, the Developer`WriteRawJSONString function is very fast
except when you pass it a huge numeric array obviously
I don't want to come off as an evangelist for using json in the library. I think more important is the idea of making it very easy to write a thin LibraryLink wrapper to an existing C++ library
I recommend LTemplate to anyone who is looking to do that
@andre314 Sadly ImageCapture has its own problems, and I want to do things like save the image every n seconds as well as update more frequently. But thanks for the thought, and it does basically work