Hello Przemek

>It will work but I do not understand how it's possible to call
>function by macro knowing it's name when macro value is created
>but in other context you do not know this name. Your above
>description does not make any sense or you simply forgot to say
>about some important conditions.
Below is some code to exemplify what I couldn't explain to you
textually. Maybe it helps.

It was enough to say that you are using DLL name as part
of name of your DLL entry function :-).
With HRB file it can be implemented easier using static
function with fixed name, i.e. HRBMAIN() in each module
which needs initialization.

Sorry, but look at DLL2D:New().
The piece of code below is to show "how it's possible to call function by macro knowing it's name when macro value is created but in other context you do not know this name". The name of the entry function is known and could be declarated as DYNAMIC in the exe, but see the macro below - it depends on the return of what you called the dll entry function:

...
cFunction := "__2D_" + ::cPrefix + ::aTopics[aaa,1] //This is the macro I'm talking about: both ::cPrefix and ::aTopics came from the DLL

        if FunctionExists(cFunction)
           ::aTopics[aaa,2] := .t.
           if ::aTopics[aaa,1] $ "KT-KR"
              ::aTopics[aaa,3] :=  & (cFunction + '("TDK")')
           else
              ::aTopics[aaa,3] :=  & (cFunction + '(,"TDX")')
           endif
        endif
...

BTW LIBLOAD()/LIBFREE() are xHarbour compatible functions.
   I suggest to use hb_libLoad()/hb_libFree().
   Your code will not work for lower case extenssion.
   I suggest to change it to sth like:
      cFunction := "__DLL__" + ;
                   left( aFiles[ddd,1], at( ".", aFiles[ddd,1] ) -1 )

okay thanks

Regards
Leandro


_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to