My is the order of parameters reversed for functions that are dynamically loaded from shared C libraries?

2015-11-15 Thread David Nies via Digitalmars-d-learn
Apparantly, the order in which parameters are passed to a dynamically loaded C function is reversed. See the following minimal example: %> cat dll.c #include "stdio.h" int dll2(const char* first, const char* second) { printf("dll2() - first: '%s', second: '%s'\n", first, s

Re: My is the order of parameters reversed for functions that are dynamically loaded from shared C libraries?

2015-11-15 Thread David Nies via Digitalmars-d-learn
On Sunday, 15 November 2015 at 18:00:09 UTC, David Nadlinger wrote: On Sunday, 15 November 2015 at 17:54:27 UTC, David Nies wrote: How can I make sure the order is correct? Whenever you use a C function, it must be marked as, even if it's through a function pointer as in this case. Just apply

Re: My is the order of parameters reversed for functions that are dynamically loaded from shared C libraries?

2015-11-15 Thread David Nies via Digitalmars-d-learn
On Sunday, 15 November 2015 at 18:12:52 UTC, David Nadlinger wrote: On Sunday, 15 November 2015 at 18:02:01 UTC, David Nies wrote: How do I mark it as such? Can you please give an example? Thanks for the quick reply! :) Just add extern(C) to the beginning of the "alias" line. — David Grea