got the ffi module to work in the basics at least

This commit is contained in:
hyung-hwan 2020-12-27 19:26:07 +00:00
parent 8303b48fd1
commit 7d2a0ed484
4 changed files with 212 additions and 579 deletions

View File

@ -2948,6 +2948,17 @@ HAWK_EXPORT hawk_val_t* hawk_rtx_makembsvalwithucs (
const hawk_ucs_t* ucs const hawk_ucs_t* ucs
); );
HAWK_EXPORT hawk_val_t* hawk_rtx_makembsvalwithbcstr (
hawk_rtx_t* rtx,
const hawk_bch_t* bcs
);
HAWK_EXPORT hawk_val_t* hawk_rtx_makembsvalwithucstr (
hawk_rtx_t* rtx,
const hawk_uch_t* ucs
);
HAWK_EXPORT hawk_val_t* hawk_rtx_makembsvalwithuchars2 ( HAWK_EXPORT hawk_val_t* hawk_rtx_makembsvalwithuchars2 (
hawk_rtx_t* rtx, hawk_rtx_t* rtx,
const hawk_uch_t* ucs1, const hawk_uch_t* ucs1,

View File

@ -354,8 +354,7 @@ void* hawk_stdmodopen (hawk_t* hawk, const hawk_mod_spec_t* spec)
lt_dladvise_destroy (&adv); lt_dladvise_destroy (&adv);
HAWK_MMGR_FREE (hawk_getmmgr(hawk), modpath); if (modpath) hawk_freemem(hawk, modpath);
return h; return h;
#elif defined(_WIN32) #elif defined(_WIN32)
@ -386,7 +385,7 @@ void* hawk_stdmodopen (hawk_t* hawk, const hawk_mod_spec_t* spec)
modpath = hawk_dupoocstrarr(hawk, tmp, HAWK_NULL); modpath = hawk_dupoocstrarr(hawk, tmp, HAWK_NULL);
if (!modpath) return HAWK_NULL; if (!modpath) return HAWK_NULL;
h = LoadLibrary (modpath); h = LoadLibrary(modpath);
if (!h) hawk_seterrnum (hawk, HAWK_NULL, hawk_syserr_to_errnum(GetLastError()); if (!h) hawk_seterrnum (hawk, HAWK_NULL, hawk_syserr_to_errnum(GetLastError());
hawk_freemem (hawk, modpath); hawk_freemem (hawk, modpath);
@ -427,7 +426,7 @@ void* hawk_stdmodopen (hawk_t* hawk, const hawk_mod_spec_t* spec)
/* DosLoadModule() seems to have severe limitation on /* DosLoadModule() seems to have severe limitation on
* the file name it can load (max-8-letters.xxx) */ * the file name it can load (max-8-letters.xxx) */
rc = DosLoadModule (errbuf, HAWK_COUNTOF(errbuf) - 1, modpath, &h); rc = DosLoadModule(errbuf, HAWK_COUNTOF(errbuf) - 1, modpath, &h);
if (rc != NO_ERROR) if (rc != NO_ERROR)
{ {
h = HAWK_NULL; h = HAWK_NULL;

View File

@ -908,6 +908,16 @@ hawk_val_t* hawk_rtx_makembsvalwithucs (hawk_rtx_t* rtx, const hawk_ucs_t* ucs)
return hawk_rtx_makembsvalwithuchars(rtx, ucs->ptr, ucs->len); return hawk_rtx_makembsvalwithuchars(rtx, ucs->ptr, ucs->len);
} }
hawk_val_t* hawk_rtx_makembsvalwithbcstr (hawk_rtx_t* rtx, const hawk_bch_t* bcs)
{
return make_mbs_val(rtx, bcs, hawk_count_bcstr(bcs), HAWK_NULL, 0);
}
hawk_val_t* hawk_rtx_makembsvalwithucstr (hawk_rtx_t* rtx, const hawk_uch_t* ucs)
{
return hawk_rtx_makembsvalwithuchars(rtx, ucs, hawk_count_ucstr(ucs));
}
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
hawk_val_t* hawk_rtx_makembsvalwithuchars2 (hawk_rtx_t* rtx, const hawk_uch_t* ucs1, hawk_oow_t len1, const hawk_uch_t* ucs2, hawk_oow_t len2) hawk_val_t* hawk_rtx_makembsvalwithuchars2 (hawk_rtx_t* rtx, const hawk_uch_t* ucs1, hawk_oow_t len1, const hawk_uch_t* ucs2, hawk_oow_t len2)

File diff suppressed because it is too large Load Diff