flat assembler
Message board for the users of flat assembler.

Index > Main > Importing symbols without type casting

Author
Thread Post new topic Reply to topic
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
Is there a way to import a symbol or reference an external symbol as an interface?
Code:
extrn 'externalinterface' as myinterface:dword
    

That's how I normally do it and then I just use comcall directly on a register. But I would like to be able to use cominvk to reference the external interface.
Post 17 Aug 2015, 13:13
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
PeExecutable
Didn't check that, but I guess, you could do the following:
Code:
interface IMyInterface,\
          MyMethod1,\
          MyMethod2

extrn 'ExternalObjectIMyInterface' as _ExternalObjectIMyInterface:dword
virtual at _ExternalObjectIMyInterface
    ExternalObjectIMyInterface IMyInterface
end virtual    


That's provided the external label references a pointer to the object. If it references the object directly, then you need to use comcall anyway, but still no need to use an intermediate register.

_________________
Faith is a superposition of knowledge and fallacy
Post 17 Aug 2015, 14:59
View user's profile Send private message Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
That makes sense, I had a thought about 'virtual at' thanks for verifying it. (It reminds me of the absolute directive from nasm.)
Post 17 Aug 2015, 16:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.