Giter Club home page Giter Club logo

Comments (4)

dotMorten avatar dotMorten commented on June 23, 2024

AFAIK the callbacks are being pinned, and event fires fine with either calling convention.

I did receive this tip recently, hinting at that we need to recompile the library with the cdecl convention.

the public 15.09a sources they have the calling convention set as stdcall just as they do in msajapi.dll If you don't change that to cdecl, you can expect random problems particularly with x64 if you call any of the variadic functions like alljoyn_msgarg_get.

Currently I'm mostly struggling with getting some of the string parameters out, like this one: alljoyn_msgarg_signature which supposedly is supposed to be done with a string builder:

        [DllImport(Constants.DLL_IMPORT_TARGET, CharSet = CharSet.Ansi)]
        internal static extern UIntPtr alljoyn_msgarg_signature(IntPtr arg,
             [MarshalAs(UnmanagedType.LPStr)][Out] System.Text.StringBuilder str, UIntPtr buf);

Note: This isn't currently what is in the generated code - working on this still.

from alljoyndotnet.

dotMorten avatar dotMorten commented on June 23, 2024

Btw shouldn't matter if the library is written in C# or VB - you can still consume it from either language. However C# definitely has the best documentation and examples to go from, and the most experts to draw knowledge from, so if you're up for some C#, I would love to get some help making this library "work". For the most part right not it's just making the interop work as I go along and wrap the classes in "nicer" .NET classes. The nice thing about the code generator for the interop is "fix once, fix everywhere", and when a new AllJoyn version comes out, I just rerun the generator against the latest source code.

from alljoyndotnet.

PeterRook avatar PeterRook commented on June 23, 2024

I really liked your API code generator, so I just the analyze part in my code. I changed to code generation part to the codedom generator! Your generator took a lot of tedious work out of my hands, and I completely agree with your fix once, fix everywhere principle. Good job!
I am not too convinced about my C# skills, so any code I would write in C# has to be thoroughly code-inspected. But if I can contribute, I gladly will. If this will lead to a more complete Alljoyn API, C# or not, I will surely use it!. After all, I want to use this in Home Automation software I am trying to create.
I am esp. interested in the security features of Alljoyn, something that is lacking or rudimentary in most Home Automation solutions I have seen so far (I had a thorough look at OpenHAB).

About the pinning: as I said I have focused on the BusListener functionality The callbacks are passed to Alljoyn using a structure. . Pinning was applied to that structure.

As mentioned earlier having a look at the Alljoyn 14.06.00 C# Unity implementation can also help.
In there the marshalling is done in code (so no attributes). I included MsgArg.cs, so you can have a look at how the alljoyn_msgarg_signature function is implemented/used
MsgArg.zip

from alljoyndotnet.

dotMorten avatar dotMorten commented on June 23, 2024

Done a lot of work on msgarg and now have a working producer and consumer. I've also moved up to AllJoyn 16.04. The cdecl issue mentioned above turned out to be a non-issue

from alljoyndotnet.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.