English 中文(简体)
• 如何在编辑D2语时输出来自DL的变数?
原标题:How to Export a variable from a DLL when compiling the D2 language with dmd?

D2语相当于dec(出口)

I have the D2 DLL linkage example code up and running. Exporting functions, both in dmd s mangled name space as well as well as in standard u-mangled "C" name space, works like a charm. But I m running into uncharted waters regarding the sharing of a (global) int Variable between DLL s as well as the main exe program... I ve checked the DLL symbol table with depends22_x86 and while I made a point of using the export directive just before the Var s declaration, it does not show up in the DLL s table, while functions do. Can one export Varibles to be visible in a DLL with the Digital Mars dmd tool chain?

问题回答

This was a bug in the compiler (Bugzilla 10059). The following code should work now.

export __gshared int foo;

或许你们可以做Ralph Tandetzky所说的话,但在固定单元的导师中。 你们胜过,必须明确称职,所有符号都将装上。 或许也可以分享。

作为一种工作,如果出口或进口全球变数不作工作,则写上表格的包装功能。

Type variable;

extern(C) Type * getGlobalVariable()
{
    return &variable;
}

如果想从D到C出口的话。





相关问题
What form is DLL & what makes it processor dependent

I know DLL contains one or more exported functions that are compiled, linked, and stored separately.. My question is about not about how to create it.. but it is all about in what form it is stored.. ...

Create Visual Fox Pro DBF with activex

any one knows if there is a activex dll that can create VFP DBF files? I mean im writing app with 1C:Enterprise 8.2 language, and i need to export some datas into VFP DBF. And i can only use activex ...

Dynamically loading a dll in C#

I have a window to use for editing. The editor should load a dll (which I have full control of) in response to the user s selection to know how to display the information visually. (They re dll s, as ...

How do I link to a DLL from javascript in XULRunner?

I have a dll (that I didn t write) and I would like to use it in an XULRunner application. I know nearly nothing about this, so bear with me. Apparently I can use XPCOM to load the dll and then call ...

Is there a minimal php5ts.dll?

I ve completed my web app and am using mongoose to serve the php pages. The whole app & mongoose is less then 2MB. The php5ts.dll is almost 5MB so that really adds bloat. Also, my app is very ...

DllGetVersion not giving expected results under Windows 7

I have some code that attempts to test whether my application is running with the themes set. Here s the C# code: internal class NativeMethods { [DllImport("comctl32", CharSet = CharSet.Auto, ...

How to restrict access to my DLL

Is possible to restrict access to my .NET DLL library? My application has more EXE assemblies and I need share some code, but I don t want someone else could use that.

Creating a thread in DllMain?

It seems that when a thread is created from within DllMain upon DLL_PROCESS_ATTACH it won t begin until all dll s have been loaded. Since I need to make sure the thread runs before I continue, I get a ...

热门标签