[Issue 6716] Linking a C program with D library causes DEH errors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 12 21:46:57 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6716


Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg at gmail.com


--- Comment #1 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-09-13 08:47:15 MSD ---
> In order to work around the problem, you have to define a main() function that
> is not extern(C) and that gets called from an extern(C) function at some point.

No, you don't need to call D `main` function. You just have to define it.

> Naturally, the downside of this method is that you can no longer use such
> library with D executables, since a redundancy is created by two conflicting
> definitions of main(). And the only way to work around the latter problem so
> far is to use a version(identifier) system...

No, you can define D `main` in a separate file, not in your library and link
with its object file. For more information read this:
http://stackoverflow.com/questions/7480046/implementing-a-c-api-in-d/7486417#7486417

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list