X# EXTERNAL is undeclared

This forum is meant for questions and discussions about the X# language and tools
Post Reply
mk_schmid
Posts: 14
Joined: Wed Jul 06, 2022 1:53 pm
Location: Germany

X# EXTERNAL is undeclared

Post by mk_schmid »

Hi,

we use the EXTERNAL command, for example in this case: “EXTERNAL Deleted”. In the X# documentation https://www.xsharp.eu/help/command_external.html (in the old VO documentation is the same) this command is included, but it does not work in our app. We do not disable the default header and we have not used any other default header file, where is the error?

Error XS0103 The name 'EXTERNAL' does not exist in the current context.


Thanks
Christian Schmid
User avatar
Chris
Posts: 4725
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: X# EXTERNAL is undeclared

Post by Chris »

Hi Christian,

I think that's a leftover from the VO help topic. In .Net, you cannot link specific functions, it's the complete assembly (dll or exe) containing them that is either loaded or not. So practically this command is not needed anymore, as it's highly unlikely that a dll used in a macro expression is not already loaded when the macro is executed. And in the rare case that this indeed happens, all you need is to just call anything from this dll in advance, in order to force them to be loaded. For non-core dialect X# dlls, this is not needed at all, as those include some initialization code, which is silently called on app startup anyway.

In order to avoid having to modify your code, you can add this on top of the .prg files that use the EXTERNAL command:

#xcommand EXTERNAL [<list,...>] => NOP

or you can put it in Include\CustomDefs.xh\

I will open a ticket for this though, to update the help file and probably add the above command in the standard definitions file.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
mk_schmid
Posts: 14
Joined: Wed Jul 06, 2022 1:53 pm
Location: Germany

Re: X# EXTERNAL is undeclared

Post by mk_schmid »

Hi Chris,
that's what I thought since I didn't find anything about it in the sources on GitHub. Since there are not many places, the code will be adapted accordingly.
Thanks
Christian Schmid
Post Reply