Trying to get some TSA to work in the appgen. Its a somefile.a linked in as an external source file in the project settings.
Then an appgen procedure calls the assembler using the
Return callA (pGetProcAddress,0,0,0,p1,p2)
(Jim Kanes jmp eax hack to call procs by address - havent tried Paul A’s 16/32bit .a loader examples yet as the prjs dont compile, so I need to find originals online and try again)
Compiles ok.
Module(‘somefile.a’)
Procname(long,long),long,proc
End
But when the compiler gets to the final dll write out, I get the unresolved external for procname@f…
What am I missing?
Do I need to create a lib file to statically link the assember procs back in, or something else?
The goal of Jim’s calldllclType class object is to make calls into a .dll without prototyping the called function first (ie: no module definition within the main application).
I hope I’m on the right track here, it looks like you’re trying to create your own .dll and call your own function called Procname from that .dll using Jim’s object, if that is correct might I suggest you…
Create your .dll in the normal manner, exporting Procname
Use an instance of calldllclType in the parent application to make the call
Jim’s method is rock solid, it automates the LoadLibrary, GetProcAddress & FreeLibrary calls flawlessly.
I’m not using his class method, Im trying to bootstrap the idea of using the getprocaddress address as first parameter from within the appgen with less lines of code.
iirc, the first param in a class method is also the address of the method when seen in the debugger and I havent got to the stage of using a class in this app yet. I dont like external sources thats all, Im just trying to keep everything within the appgen.
Its the same thing Paul A’s doing with the module(), procedure prototype PROC and Type to trick the compiler into allowing a getprocaddress(TypedWinApiPrototype) aka *TypedWinApiPrototype to be passed as a param to be called.
Its not the name, syntatically its verbatim inside the appgen, I just dont think I can trick the compiler anymore than has already been done.
Ive got one last trick to try, which is creating a class type in the global embeds and exploit the first param of the class seen in the debugger with the getprocaddress address.
Im trying to reduce the use external files, because it catches noobs when the code is taken over plus files go missing and get changed easily.
It is trying to find your proc as if it were a standard Clarion proc. That’s a standard mangling style. If you use NAME(‘procname’) in the prototype, then it won’t try to mangle the name.
But this an assembler external source file in the project settings, it cant find despite it being compiled first and putting a module(‘myfile.a’) with myacall procedure(long,long,long,long),long prototype in the global embeds.
When using Clarion procedures without the NAME() attribute, the compiler/linker use name mangling to associate the procedures. So your “myacall (long,long,long,long),long” prototype gets mangled to “MYACALL@Fllll”
So if you had multiple procedures of the same name, this is how procedure overloading is managed. The prototype itself changes the name.
When you put your assembler procedure in the map, you have to tell the compiler that it shouldn’t attempt to mangle that name like it does with Clarion procedures.
Ok I didnt know Carl had done a name mangler or that was how it was mangled, I read one of Larry Chens blogs and got the impression name mangling was prepending with _stuff not altering the end of the @…
Anyway its compiling and I can follow the assembler in the debugger dissembly window now, so I can then see how the static lib works compared to Jim Kanes and Pauls variants and see whats actually going on.
I never got taught any of this at school partly because it wasnt finalised in windows, it was still dos and cpd2.1 and we had to learn UK platforms.
So I was going to say no not strictly true but looking back at the callback methods in my systray class, the callback methods are actually defined outside of the class and are in the member() section.