IT-Consultant: James C. Fuller > Discussion

TCLib update for Patrice

<< < (8/8)

Patrice Terrier:
James--

I have seen it already, but what i am looking for is a replacement for the PowerBASIC statement "AS ANY"
without using va_list


Currently i am doing this to use swprintf with long, and i must have another function for float, double, etc.

--- Code: ---#define long_proc_c typedef long (__cdecl *zProc)

HMODULE MSVCRT() {
    static HMODULE hModule;
    if (hModule == 0) { hModule = LoadLibrary(L"MSVCRT"); }
    return hModule;
}

long long_swprintf(OUT WCHAR* buffer, IN WCHAR* format, IN long N) {
    long nRet = -1; // Error
    HMODULE hModule = MSVCRT();
    if (hModule) {
        long_proc_c (WCHAR*, WCHAR*, long);
        zProc hProc = (zProc)GetProcAddress(hModule, "swprintf");
        if (hProc) { nRet = hProc(buffer, format, N); }
    }
    return nRet;
}
--- End code ---

Patrice Terrier:
James, Fred,

I have attached the latest Visual Studio 2015/2017 TCLIB version of my 64-bit OpenGL plugins
to this post
C++bbp_plugins64.zip

The smallest dll is only 13 Kb.

James C. Fuller:
Thanks Patrice,
  I realize now why you were having problems with rand and srand as I found issues with my own work.
I assume one of your included files:
  #include <gl/GL.h>
  #include <gl/GLU.h>
is pulling in <stdlib.h> or one of the other msvcrt include files.

I had done a lot of successful testing originally with my port of José's CWindow and Afx framework but when I tried with my latest version of TCLib I had a number of redefinition errors.
I was including:
   #include <psapi.h>
   #include <Shlobj.h>
   #include <KnownFolders.h>
   #include <shlwapi.h>
   #include <commctrl.h>
   #include <uxtheme.h>
and at least one of them is pulling in msvcrt include files.

I write all my bc9Basic code as ansi. I then parse the c++ translated code with the ULEX utility which does all the transformations. I can name the library function tcl_rand and translate the source "rand" call to tcl_rand on the fly.
I am scratching my head though as only a few are a causing problems.

James


Navigation

[0] Message Index

[*] Previous page

Go to full version