add-in / dll import function

Y

youssma

hi,
i have developped an add-in that exports some functions to the excel api
throw the excel4(xlfregister..) function. But i need to export some other
functions that are defined in another dll (linked to the add-in). i didn't
success to make it work.
someone has an idea about what should be done for that?
many thanks in advance
youssma
 
Y

youssef alaoui

You are probably having an issue in the way you compiled the addi-ins.
There are two methods used for calling a routine.  The "standard
microsoft method" and the "C-Language method".  Depending on the
compiler options and the declarations of the function how the functions
are called.  Often DLLs have multiple netry points for the same function
which provides compatibility for being called from bot methods.

I think the solution is in the 1st DLL make sure you define the 2nd Dll
functions using the correct method.

--
joel
------------------------------------------------------------------------
joel's Profile:http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:http://www.thecodecage.com/forumz/showthread.php?t=150545

Microsoft Office Help


hi joel,
thanks for your answer.
do you mean that i need to duplicate the declarations of my functions
in the xll and make an explicite (or implicite call) from them to the
functions declared in my dll? this will make the calling process slow.
i was wonderning if there was a solution that enables me to register
my functions from the dlll directly to the excel menu interface.

youssma
 
Y

youssef alaoui

first you still have to solve your inital calling problem if you where
going to create an add-in to be loaded into excel.  Second, I think you
are wrongg with the speed issue.  If you don't declare a variable in VBA
is is assumed to be a variant.  When you have variants excels can learn
from the object(s) the properties but this takes longer the first time
you call the code.

Here is an example of the declaration statement when calling a dll from
VBA

Public Declare Function FtpGetFile Lib "wininet.dll" Alias
"FtpGetFileA" _
(ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _
ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean,
ByVal dwFlagsAndAttributes As Long, _
ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean

The calling process use the Microsoft Standard method for creatting the
call stack.  Most compilers on windos have options to either compile the
code as Standard or C-Language.  If you don't understand tthe difference
see this article

'Calling convention - Wikipedia, the free encyclopedia'
(http://en.wikipedia.org/wiki/Calling_convention)

--
joel
------------------------------------------------------------------------
joel's Profile:http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:http://www.thecodecage.com/forumz/showthread.php?t=150545

Microsoft Office Help

i'm trying to use the c-language calling procedure by using an xll to
load my function in the excel menu. i succeded to load functions that
are declared in the xll i'm using but my question is about loading
throw this xll, functions that are declared in an other dll.
anyway, thank you for your answers. i'll search deeply on that.
many thanks

regards,
youssma
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top