September 10, 2005
Hi everyone,

Let's say I have these two functions in a C library:

extern void Foo(MagicPtr);
extern void Bar(MagicPtr, int, char*);

And these opaque structs in that same C library:

typedef void* MagicPtr;
extern MagicPtr HeapAllocator;
extern Magicptr ExtantAllocator;

Now when I convert the header to a D Programming Language interface, I'm doing this...

-----------------------------
module funny.magic

struct __Magic { }
typedef __Magic* MagicPtr;
extern (C) Foo(MagicPtr);
extern (C) Bar(MagicPtr, int, char*);
extern (C) MagicPtr HeapAllocator; // Nope.
extern (C) MagicPtr ExtantAllocator; // Nope.
-----------------------------

It appears that D is not using HeapAllocator and ExtantAllocator identifiers as linked in from the libMagic.lib, but rather is creating its own HeapAllocator and ExtantAllocator identifiers.

When linking, the HeapAllocator and ExtantAllocator are producing link warnings for duplicate symbols.

Hmmm.

What is the correct way to specify the external linkage of those two identifiers in the C-to-D interface module?

Thanks,
--Eljay
September 10, 2005
I see how to do it, here:
http://www.digitalmars.com/d/htomodule.html

Thanks,
--Eljay