On Wednesday, 19 April 2023 at 14:42:44 UTC, bachmeier wrote:
[...]
My understanding (from my occasional use of Windows) is that DMD installs the Community Edition of Visual Studio. That should solve your original issue, and you shouldn't need to mess with sppn.exe.

Well it took a little while, but I can confirm that if you have a D function like:

```
extern(C) void DCallee() {
   import core.stdc.stdio : printf;

   printf("Entered DCallee.\n");


   printf("Exiting DCallee.\n");
}
```

called from a C function like:

```
//  C Master calling D (under -betterC restrictions).

#include <stdio.h>

extern void DCallee();

int main()
{
   printf("MastC Entered.\n");

   DCallee();

   printf("MastC Exiting.\n");
   return 0;
}
```

Where the compilation is run from the batch file:

```
Rem Compile, link and run batch file.
IF EXIST .\DCallee.exe del .\DCallee.exe
IF EXIST .\DCallee.map del .\DCallee.map
IF EXIST .\DCallee.obj del .\DCallee.obj

IF EXIST .\MastC.exe del .\MastC.exe
IF EXIST .\MastC.map del .\MastC.map
IF EXIST .\MastC.obj del .\MastC.obj

dmd -m32omf -betterC -c DCallee.d

dmc MastC.c DCallee.obj
MastC.exe
Rem Exited compile, link and run batch file.
```

Then everything runs properly.

As an aside, it was a surprise to me to discover that the order of the file names in the dmc line was significant, bearing in mind MastC.c contains a 'main' function, and DCallee.d does not.

As a further aside, I do recall the installer loading Visual Studio, but it didn't seem to help.

  • ImportC issue? DLearner via Digitalmars-d-learn
    • Re: ImportC... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: ImportC... bachmeier via Digitalmars-d-learn
      • Re: Imp... DLearner via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... DLearner via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
            • ... bachmeier via Digitalmars-d-learn
              • ... DLearner via Digitalmars-d-learn

Reply via email to