On Friday, 16 May 2014 at 14:52:17 UTC, Marc Schütz wrote:
But that's extern(C++), not extern(C)...
That should be a different name mangling, so won't link. Winapi
functions are declared as extern C for C++ compiler.
For example, windows headers do use C++ -references in function
signatures and msdn provides code examples using that convention,
the equivalent in D is ref.
On Friday, 16 May 2014 at 11:42:35 UTC, Kagamin wrote:
For example, windows headers do use C++ -references in
function signatures and msdn provides code examples using that
convention, the equivalent in D is ref.
But that's extern(C++), not extern(C)...
On Friday, 16 May 2014 at 14:52:17 UTC, Marc Schütz wrote:
On Friday, 16 May 2014 at 11:42:35 UTC, Kagamin wrote:
For example, windows headers do use C++ -references in
function signatures and msdn provides code examples using that
convention, the equivalent in D is ref.
But that's
On 05/16/2014 08:15 AM, Andrew Brown wrote:
I guess my confusion came about because in the page about interfacing
with C, there's a static array example where parameters are given in
terms D understands:
extern (C)
{
void foo(ref int[3] a); // D prototype
}
I guess D has no problem
I guess my confusion came about because in the page about
interfacing with C, there's a static array example where
parameters are given in terms D understands:
extern (C)
{
void foo(ref int[3] a); // D prototype
}
I guess D has no problem translating that into a simple pointer
that C can
On 05/16/2014 08:24 AM, Ali Çehreli wrote:
On 05/16/2014 08:15 AM, Andrew Brown wrote:
void foo(ref int[3] a); // D prototype
Since we know that references are implemented as pointers, 'ref int[3]
a' is passed as a.ptr.
Sorry, that's confusing. Yes, it ends up being equal to a.ptr
I'm trying to calculate residuals after fitting linear
regression, and I've got some code in C using the gsl which
should do it. Everything works fine if I use static arrays
(below, defining X[15], y[5] etc.). Trouble is, I won't know the
number of individuals or covariates until runtime, so
On 05/15/2014 01:55 PM, Andrew Brown wrote:
extern(C) {
void regress(int nInd, int nCov, ref double[] x, ref double[] y, ref
double[] rOut);
}
I don't think that should even be allowed. C functions should not know
or be compatible with 'ref' D parameters. Define the arguments as simple
That worked a treat! Thank you very much!
On Thursday, 15 May 2014 at 21:11:54 UTC, Ali Çehreli wrote:
On 05/15/2014 01:55 PM, Andrew Brown wrote:
extern(C) {
void regress(int nInd, int nCov, ref double[] x, ref
double[] y, ref
double[] rOut);
}
I don't think that should even be
10 matches
Mail list logo