473,568 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Building Compatible Libraries

From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Jan 10 '07 #1
10 1235

Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
The standard says nothing about libraries.

Jan 10 '07 #2
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
It does not.

This only works if the compiler vendors make their implementations
compatible.

One thing that is guarenteed is the order in which struct members a laid
out, but nothing about padding is guarenteed.

Having said all this, there are alot of implementations that follow the
same methodology as well as supporting things like #pragma pack or other
alignment control mechanisms.
Jan 10 '07 #3

"Noah Roberts" <ro**********@g mail.comwrote in message
news:11******** **************@ i39g2000hsf.goo glegroups.com.. .
>
Peter Olcott wrote:
>From what I understand data alignment is not one of the things that has been
standardized . If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?

The standard says nothing about libraries.
Well then, how is this accomplished in real world practice?
Jan 10 '07 #4

Peter Olcott wrote:
"Noah Roberts" <ro**********@g mail.comwrote in message
news:11******** **************@ i39g2000hsf.goo glegroups.com.. .

Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
The standard says nothing about libraries.

Well then, how is this accomplished in real world practice?
The target platform usually has some sort of spec for dynamic
libraries. There may be other specs to work from as well. In other
words, it's platform specific and not really guaranteed to work.

see http://mingw.sourceforge.net/mingwfaq.shtml#faq-msvcdll for example.

Jan 10 '07 #5
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.
Jan 11 '07 #6

"Ian Collins" <ia******@hotma il.comwrote in message
news:50******** *****@mid.indiv idual.net...
Peter Olcott wrote:
>From what I understand data alignment is not one of the things that has been
standardized . If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.
That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.
Jan 11 '07 #7

Peter Olcott wrote:
"Ian Collins" <ia******@hotma il.comwrote in message
news:50******** *****@mid.indiv idual.net...
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has been
standardized. If this is true, then how are libraries constructed such that
one
vendor's compiler can directly access aggregate data types such as <struct>
where these types were compiled using another vendor's compiler?
Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.

That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.
Oh, I think you're looking for specs like Corba or COM.

Jan 11 '07 #8

"Noah Roberts" <ro**********@g mail.comwrote in message
news:11******** **************@ k58g2000hse.goo glegroups.com.. .
>
Peter Olcott wrote:
>"Ian Collins" <ia******@hotma il.comwrote in message
news:50******* ******@mid.indi vidual.net...
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has
been
standardized . If this is true, then how are libraries constructed such
that
one
vendor's compiler can directly access aggregate data types such as
<struct>
where these types were compiled using another vendor's compiler?

Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.

That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.

Oh, I think you're looking for specs like Corba or COM.
For my purposes the prior suggestion will probably be optimal. I always try to
go with the simplest possible solution that completely solves the problem. Since
I am interfacing between C++ and a language following to "C" calling
conventions, the prior answer should work the best, and be entirely sufficient
for my needs.
Jan 11 '07 #9

Peter Olcott wrote:
"Noah Roberts" <ro**********@g mail.comwrote in message
news:11******** **************@ k58g2000hse.goo glegroups.com.. .

Peter Olcott wrote:
"Ian Collins" <ia******@hotma il.comwrote in message
news:50******** *****@mid.indiv idual.net...
Peter Olcott wrote:
From what I understand data alignment is not one of the things that has
been
standardized. If this is true, then how are libraries constructed such
that
one
vendor's compiler can directly access aggregate data types such as
<struct>
where these types were compiled using another vendor's compiler?

Probably the only safe way is to keep types opaque and provide the
public interface as extern "C" functions.

--
Ian Collins.

That is what I was thinking. This eliminates alignment differences and
differences in the derivation of the underlying naming conventions.
Oh, I think you're looking for specs like Corba or COM.

For my purposes the prior suggestion will probably be optimal. I always try to
go with the simplest possible solution that completely solves the problem. Since
I am interfacing between C++ and a language following to "C" calling
conventions, the prior answer should work the best, and be entirely sufficient
for my needs.
I would at least look at those options and see if they meet your needs.
I've seen a lot of rather poor wheel "innovation s".

Jan 11 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
276
by: Lee Gillie | last post by:
We have systems built upon shared libraries, which are maintained by a group of programmers. We install these to the GAC on production servers. For saftey, when a programmer uses one of these libraries in a project they will GET-LAST-VERSION from SourceSafe, and build the library. With version as "1.0.*", and new numbers are assigned during...
0
1279
by: Lee Gillie | last post by:
We have systems built upon shared libraries, which are maintained by a group of programmers. We install these to the GAC on production servers. For saftey, when a programmer uses one of these libraries in a project they will GET-LAST-VERSION from SourceSafe, and build the library. With version as "1.0.*", and new numbers are assigned during...
7
2368
by: Hal Vaughan | last post by:
I have a problem with port forwarding and I have been working on it for over 2 weeks with no luck. I have found C programs that almost work and Java programs that almost work, but nothing that does what I need. I've even tried writing a port forwarder in Java and found problems that nobody seems to have the answer to in forums. I need to...
13
3100
by: treble54 | last post by:
I need to build PHP from source with the pdo_ibm extension and I am having an issue with it. Firstly, I am using Visual Studio .NET 2003 and I am building PHP from source through the Visual Studio Command Prompt. When I get to the nmake step, it gets through everything until it hits the zend_language_scanner.l file. Then I get these errors: ...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8117
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.