[Gambas-user] Distribution of custom shared libraries

Cedron Dawg cedron at exede.net
Sat Feb 23 01:11:28 CET 2019


Here is the source code for the simple demonstration program.  Not quite farm ready yet, but you can see what I am doing.

In this particular case, the original 3.1.1 matched the C version without the Filler field.  When I upgraded to 3.12.2 the padding was introduced.  Adding the Filler variable made them align again.

Also, I tried all sorts of variations of strings to match the char[128] field.  I found that the byte array worked just fine combined with a .ToString() call.  Is there a preferred way?


----- Original Message -----
From: "Benoît Minisini" <g4mba5 at gmail.com>
To: "user" <user at lists.gambas-basic.org>
Sent: Friday, February 22, 2019 6:23:00 PM
Subject: Re: [Gambas-user] Distribution of custom shared libraries

Le 22/02/2019 à 20:26, Cedron Dawg a écrit :

Without your full source code, I can't tell you. It's just that a 
structure may be aligned differently by the C compiler, whereas Gambas 
has a deterministic algorithm for that. And the result may not be the 
same as soon as there are holes or unaligned fields in your structure.

AFAIK, there is no norm for structure implementation in C: the compiler 
can reorder the fields and add memory holes as it wants, changing its 
mind between 32 bits / 64 bits and between versions.

So it's almost impossible for an interpreter to deal with that in all 
cases. :-(

-- 
Benoît Minisini

----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GamePadShow-0.0.2.tar.gz
Type: application/x-compressed-tar
Size: 14406 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190222/bc51d693/attachment-0001.bin>


More information about the User mailing list