[sword-devel] Sword Windows library problem

Daniel Hughes trampster at gmail.com
Sat Sep 6 05:32:33 MST 2014


Your the first person to try the bindings on windows.

It could be the calling convention.

The bindings are written to use Cdecl calling convention.

It may be that Visual studio has built sword using the stdcall calling
convention.

I will need someone who knows more about c/c++ and the calling
conventions to comment on this.

You can try changing the calling convention in the bindings by editing
them in the NativeMethods.cs class to confirm this.

However if it turns out that sword does use a different calling
convention on windows to linux then that could be a problem. It may be
that you need to tell Visual Studio to build sword using Cdecl calling
convention.



On Sat, Sep 6, 2014 at 5:50 AM, Jon Behrens <jbb at crimsonthread.com> wrote:
> Hello
> Having gotten the C# binding examples to work in Linux, I thought I'd try
> the same thing in
> Windows. I built libsword.dll using the instructions at:
>
> http://crosswire.org/wiki/Tutorial:Compiling_%26_Installing_SWORD_on_Windows
>
> After renaming the icu directory to icu-sword so the make file could find
> it, everything builds
> using Visual Studio 2013.
>
> So then copy the Linux directory /bindings/csharp to a Windows directory and
> open the project
> in VS2013. Again everything builds properly.
>
> When I try and run the lookup example, I get an exception saying that
> libsword.dll  is a program
> with an incorrect format. In the trace below, the error is listed as in
> CSSword, but it occurs when
> CSSword tries to access libsword.dll
>
> Anyone have any idea what's going on?
>
> Best,
> Jon
>
> {"An attempt was made to load a program with an incorrect format. (Exception
> from HRESULT: 0x8007000B)"}
>     [System.BadImageFormatException]: {"An attempt was made to load a
> program with an incorrect format. (Exception from HRESULT: 0x8007000B)"}
>     Data: {System.Collections.ListDictionaryInternal}
>     HelpLink: null
>     HResult: -2147024885
>     InnerException: null
>     Message: "An attempt was made to load a program with an incorrect
> format. (Exception from HRESULT: 0x8007000B)"
>     Source: "CSSword"
>     StackTrace: "   at
> Sword.NativeMethods.org_crosswire_sword_SWMgr_new()\r\n   at
> Sword.Manager..ctor() in
> n:\\development\\swordCsharp\\csharp\\Manager.cs:line 28"
>     TargetSite: {IntPtr org_crosswire_sword_SWMgr_new()}
>
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page



More information about the sword-devel mailing list