Slang: Suppressing 'static' declarations
Stephan Rudlof
sr at evolgo.de
Thu Jan 12 19:20:04 UTC 2006
Hello Eddie,
there is Object>>cCode: or Object>>cCode:inSmalltalk:, see e.g.
RePlugin>>allocateByteArrayAndSetRcvrPCREPtrFromPCRE: aPCREPtr
for an example. With these constructs you can inject arbitrary C code
into the generated C code.
In RePlugin>>declareCVarsIn: you can see how to declare a header file,
there is the line
cg addHeaderFile:'"rePlugin.h"'.
; this header file is located in dir
SomeBaseDir/platforms/Cross/plugins/RePlugin/
You could put the extern vars into a respective header file.
Regards,
Stephan
On 12.01.2006 10:49, Eddie Cottongim wrote:
> Hi,
>
> I'm trying to write a plugin that will call some hand-coded c functions
> in another file. It also needs to share variables via 'extern' with this
> other file.
>
> So in my plugin(class side) I have something like:
>
> declareCVarsIn: aCCodeGenerator
> aCCodeGenerator var: 'height' declareC: 'int height'.
> aCCodeGenerator var: 'width' declareC: 'int width'
>
> This generates, in C,
> static int height;
> static int width;
>
> If I understand this right, the 'static' keeps me from also making these
> extern, and also prevents me from sharing the other way by using
> 'extern' in the other file. I guess having lots of externs would clog up
> the namespace but for now I'd just like to get this to work.
>
> I see in the CCodeGenerator where the static is added, but I'm not sure
> what the proper way is to suppress this. Any hints?
>
> I am working in Squeak 3.7 (its the latest version for which I have
> managed to get VM generation going).
>
> Thanks,
> Eddie
>
>
>
--
Stephan Rudlof (sr at evolgo.de)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
More information about the Squeak-dev
mailing list
|