xsharp.eu • X# EXTERNAL is undeclared
Page 1 of 1

X# EXTERNAL is undeclared

Posted: Thu Jul 18, 2024 9:32 am
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

Re: X# EXTERNAL is undeclared

Posted: Thu Jul 18, 2024 9:59 am
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.

Re: X# EXTERNAL is undeclared

Posted: Thu Jul 18, 2024 11:19 am
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